defunct commit?

Alan DeKok aland at
Tue Sep 29 22:35:25 CEST 2009

Alexander Clouter wrote:
> Meant this one:

  Ah.  That's deep magic. :)

  In order to avoid mutex locks where possible, the "request" pointers
magically become invalid after a request has been proxied.  Referencing
them after a "proxy_listener->send" call will result in crashes.

  Why?  Thread race conditions.

thread 1) send proxied request packet
thread 2) receive response
thread 2) muck around with request
thread 1) access request
server)   Boom!

  Thread programming isn't hard if you have a twisted mind.

  The alternative is for every "request" to have a mutex associated with
it.  Threads lock the mutex when they're access the request, which
prevents any other thread from mucking with it.  This is also a lot more
expensive, and (IMHO) complicated.

  Alan DeKok.

More information about the Freeradius-Devel mailing list