Hi,

About a month ago a user reported a crash in tntnet. They have a server 
running with ssl and after one or two days, tntnet crashed with a error 
message "pthread_mutex_unlock failed": errno 1: Operation not permitted.

Yesterday I was finally able to reproduce the bug and today I fixed it 
and checked the fix in.

The bug was not related to ssl at all. It was a racing condition The bug 
has always been in tntnet.

The problem was, that when a request arrives, the thread passes the task 
for waiting for new connections to a new thread. It may happen, that the 
new thread takes it over, accepts a new connection, reads the request 
and answers it before the previous thread drops ownership of this new 
task. The new thread then releases the job before the old and since the 
old thread holds the task longer, it will do the clean up. This clean up 
includes unlocking the session scope. But since the new thread locked 
the session scope, the old thread is not allowed to release the lock. 
The solution is just to drop the ownership of the new job before 
releasing the lock of the job queue in the old thread.

The bug happens only when the client do not use keep alive. Normally a 
browser always uses keep alive. This may be the reason, why it has never 
been a problem.

Tommi

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to