I have been in the business for 20+ year and instructed many juniors but I have never ever seen someone cry. I honestly do not know how I would handle a junior crying over a software problem.

My base rule is: Leave the task when you get frustrated with it. Come back after you clamed down after a coffee or some meditation or some time in the gym.