Forum: Ruby on Rails what does config.threadsafe! actually do?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2009-02-10 23:39
Does anyone know what config.threadsafe! actually does, what effect(s)
it has?  I'm even sure where to go looking in the source code for
effects of a config variable like that, but if someone has source to
recommend, I'll give it a shot (although I sometimes have trouble
comprehending AR source, I must admit).

I know it tells Rails to do concurrency request handling. Okay, so far
so good. But I suspect it does other things to to them make Rails behave
differently to support concurrent request handling, rather than simply
remove a mutex around the event loop or whatever.

I ask this because, while I'm not actually interested in concurrent
request handling (don't need it), I _do_ use threads in my Rails app for
other purposes. (Dealing with long-running processes, dealing with
talking to slow external web services).  I'm actually surprised that
nobody else seems to have a use case for this, but in my app it's pretty
crucial.  So I'm trying to figure out what Rails 2.2 can do for me, and
how I'll have to change my Rails 2.1 code to deal with it, etc..  The
changes around supporting threading more intentionally are potentially
good, but the only documentation or writing I can find on it (and very
little of that) assumes you are interested in concurrent request

Since I'm not, I don't neccesarily want to call config.threadsafe!. But
I'm wondering if there are side effects of config.threadsafe! that I
might want to trigger myself, to make Rails happier about handling
multiple threads (possibly with AR) even without concurrent request

Anyone have any info to point me to?
8da92d4ed91aa12535f6d870fa76b25e?d=identicon&s=25 Aaron Baldwin (Guest)
on 2009-02-11 10:14
(Received via mailing list)
There is some good information right in the rails 2.2 release notes
along with links to blogs with more information.

0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2009-02-11 16:54
Aaron Baldwin wrote:
> There is some good information right in the rails 2.2 release notes
> along with links to blogs with more information.

Thanks Aaron. I definitely checked that out before posting, but it (and
it's links) don't have quite enough information for me. They don't
really say what config.threadsafe! _does_, except for allow concurrent
request handling.

Guess I'll have to dive into the source at some point.
This topic is locked and can not be replied to.