Registration fails with timeout on Gravatar


(Mic) #1

I have an issue with registrations on our Discourse 1.1.2

When submitting the registration form, Discourse runs into the following error:

Net::ReadTimeout

Backtrace shows that the timeout occures when trying to download the avatar image from Gravatar

/var/www/discourse/app/models/user_avatar.rb:20:in update_gravatar!
/var/www/discourse/app/models/user.rb:645:in refresh_avatar

The user account is not being created.

This leaves us in the situation that registration is impossible because of some timeout with Gravatar.

Sending a test email succeeds, by the way.


(Jeff Atwood) #2

Is gravatar blocked on your network? That is odd because gravatar is not required, we generate local avatars.


(Sam Saffron) #3

we need to push all gravatar stuff to a background job, its a bug that popped up elsewhere.


(Mic) #4

Maybe. We are running our own Autonomous System and are currently experiencing routing problems.

Can you give me an exemplatory Gravatar URL to check with curl on a shell?


(Mic) #5

When I try to register with an email address that has no associated gravatar account, everything runs smoothly as expected.


(Sam Saffron) #6

sounds like some very odd networking issues on your side, I still support fixing this, but you need to look at your network.


(Mic) #7

Got it!

We are routing the machine through a GRE tunnel. Therefore, a reduced MTU of 1476 bytes is in the way. Most sites correctly detect the path MTU and adjust accordingly, but Gravatar belongs to one of those lesser able networks which filter the ICMP messages (fragmentation needed) and break TCP connections.

I needed the following on the machine hosting the Docker container for Discourse:

iptables -I FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400

Now account creation works fine.


(Jeff Atwood) #8

Anyway, I definitely agree that not being able to access Gravatar should NOT break new account signup. @zogstrip can you have a look? I don’t want to totally rearchitect this at the moment but I absolutely want it skipped if we can’t connect to Gravatar.

I believe this ties into the “hey, you’ve posted 10 times and haven’t set an avatar” user education panel that @eviltrout originally worked on… but it’s so much less urgent now that

  • we support local avatars by default (and that is the default)
  • custom local avatars are possible

(Sam Saffron) #9

No big rearchitecture is needed, it the on save hook just needs to trigger a job as opposed to inline downloading gravatar.


(RĂ©gis Hanol) #10

Gravatar download is now done in a background job :penguin:

https://github.com/discourse/discourse/commit/521226f4c9dc88d9398438194d3c3f61e673b4f3


(RĂ©gis Hanol) #11