The weakness here the lack of Entropy in the password reset code.
I mean that you choose a random 6 digit number(338625), and try it against many users. So the attacker has to guess a reset code from 10^6 possibilities.At some point it may work.
Calculation: Since Facebook has a large user base and receives large number password reset requests say 10000 (10^4) in 3 minutes before they expire , which is comparable to 10^6. 
The probability that this password rest code is valid against some user is 0.01 .
Is making the reset code much bigger will help resolving the problem,
  or Facebook will need a new reset technology?
Facebook can simply fix it by increasing the entropy of password reset code.
This can be done easily by :
- Having Alphabets( 
[A-Z|a-z]- 52),Digits( 0-9-10),Special characters(say 10 ) in the password reset code.  
- Having a good length of say 10 characters (Answer by Rоry McCune).
 
Calculation: For a reset code of length of 6,the attacker now have to guess a reset code among (52+10+10)^6 . 
The probability that this reset code randomly chosen by attacker matches a valid password reset code among the above 10^4 is 0.000000071 or 7.1*10^-8. Instead of doing this, the attacker have better chances of guessing password itself and trying it against many users.
How to defend from this attack, should I reset it again after I
  receive the reset message from the attacking process, or should I
  reset via mail?
I think efforts to secure against this attack should come from Facebook.
Since, users may not look in to the reset message/email as soon as it arrives. From user point of view all i can think is of enabling Two Factor Authentication.