Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Ruby's Net::HTTP threadsafe on JRuby

The Net::HTTP that ships with JRuby appears to be the same/similar to the one that ships with MRI Ruby.

Does anyone know if this implementation is, or is not, thread-safe (and, how you know).

My only evidence is the existence of the net-http-persistent library, which claims to be a thread-safe library that uses Net::HTTP.

Examining the source for Net::HTTP doesn't reveal any obvious shared state.

Anyone have any more info?

like image 462
davetron5000 Avatar asked Apr 10 '26 05:04

davetron5000


1 Answers

Depends on what you mean by thread safe. Net::HTTP uses TimeOut which is generally considered broken because of it's use of Thread#raise and thread#kill. Look here... http://blog.headius.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html

like image 124
Henry Avatar answered Apr 11 '26 23:04

Henry