Bug in session.rb?

C

Carl Youngblood

I think I may have found a bug in ruby/1.8/cgi/session.rb. In the
FileStore class's restore method, it acquires an exclusive lock on the
session file in order to read it in safely, but it doesn't release it.
I've been running mod_fastcgi, which keeps multiple processes resident
in memory to handle cgi requests. The first cgi request to get the lock
stays in memory and doesn't allow it to be accessed in the future. I've
fixed this by simply releasing the lock after it is no longer needed. I
just added the following line to the end of FileStore::restore:

@f.flock File::LOCK_UN

Carl Youngblood
 
Y

Yukihiro Matsumoto

Hi,

In message "Bug in session.rb?"

|I think I may have found a bug in ruby/1.8/cgi/session.rb. In the
|FileStore class's restore method, it acquires an exclusive lock on the
|session file in order to read it in safely, but it doesn't release it.
|I've been running mod_fastcgi, which keeps multiple processes resident
|in memory to handle cgi requests. The first cgi request to get the lock
|stays in memory and doesn't allow it to be accessed in the future. I've
|fixed this by simply releasing the lock after it is no longer needed. I
|just added the following line to the end of FileStore::restore:
|
|@f.flock File::LOCK_UN

flock would be released when you close the port, thus don't forget to
close the session, that eventually closes @f inside. I will examine
adding LOCK_UN anyway.

matz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,364
Latest member
Stevanida

Latest Threads

Top