Oooooh, you're right. Unlock is called twice. This is code in a Rails  lugin, and I know that's no disclaimer of responsibility for its  
working right. I still have to take responsibility for that. I'll let  he author know, but here's a follow-on question.

Assuming bad behavior on the part of the client code (in this case,  
calling unlock twice), should this be rescued, the error logged, and  
an attempt made to keep the server alive or should the process  
terminate (as it currently does)?

I believe the intent was well-intentioned but that it doesn't prevent  oncurrency issues cross-process and obviously provides no benefits in  ails process because Rails puts a great big mutex around the whole  equest/response pipeline.

Thanks for looking into this.

--steve

On Jan 19, 2008, at 7:44 AM, Radosaw Buat wrote:

>> And even if it would be multi threaded it won't work. Every time
>> store_visits methods is executed new mutex is created, so there won't
>> be synchronization.
>>
>
> The reason for error message "ThreadError (not owner):
> /vendor/plugins/sitealizer/lib/sitealizer.rb:80:in `unlock'
> (...)
> "
> is that you call 'unlock' method twice. 'ensure' block is ok, so
> remove previous calling (a the end of begin block).
>
> -- 
> Radosaw Buat
>
> http://radarek.jogger.pl - mój blog