Question

Multiple sources claim ActiveScaffold isn't thread safe:

From those I gather controller level configuration changes and authorization aren't thread-safe. Is it safe to consider an application thread-safe if it doesn't use those components of ActiveScaffold? Are there any other features in ActiveScaffold that aren't thread-safe?

Was it helpful?

Solution

Unfortunately there is not much in the way of official documentation on this matter, however there are two useful quotes from developers which may help you here. First, in 2010, here on this thread a developer stated:

In the controller, using marked_records. Marked records are stored in session, so they only can be accessed from the controller. Model methods were a hack to get the model methods from current controller, but it was using class variables which is not thread safe.

ActiveScaffold is not thread safe ATM, but I will fix current non thread safe code later and I don't want to add more non thread safe code. If model methods are needed I will add them using thread variables

This indicated the original intent was that there would not be thread-safety. However it was being developed.

After this point discussion on the matter seems to have become quiet and I cannot find any further official statements. However people commenting on resent versions have said that the only threading issue is that changes to active_scaffold_config must be placed inside some kind of lock in order to be safe and that the rest of the system should now be threadsafe.

Beware, I cannot find official docs to prove this, it is only based on the comments of users who have read over the code base so I would not guarantee this to always be the case, but given the comments of a dev saying no more non-threaded code would be added this is likely a safe bet.

Finally, note this thread it implies that the code-base is now nearly thread safe and threads can be used as long as you take a few precautions and use workarounds in a few places.

I am sorry I do not have a more authoritative answer here, the documentation on this is sparse and reading the code is difficult to be sure either way but this is the closest to sure I can get (it seems people have had success using it with threads in production at least).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top