You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 24.71-b01 on 1.7.0_71-b14 +jit [mswin32-x86_64]
This came up in a rails 4.2 app but I think I have isolated the problem as having something to do with either JRuby threading or possibly the oniguruma lib.
When I execute this script, it will typically create and clean up threads as expected. Then usually after about 50 or more attempts, one of the threads gets stuck and does not end.
require 'pp'
ct = Thread.current
puts "Main: " + ct.inspect
1000.times do |a|
puts "Attempt #{a}"
1000.times do
Thread.new do
10000.times do
sql = "SELECT t.* FROM ( SELECT ROW_NUMBER() OVER(ORDER BY [app_users].[id] ASC) AS _row_num, [app_users].* FROM [app_users] WHERE [app_users].[id] = 17 ) AS t WHERE t._row_num BETWEEN 1 AND 1"
sql.gsub(/N'(?:[^']+|'')+'/m){|m|m.truncate(1000, omission:"[TRUNCATED]'")}
end
end
end
check_count = 0
while true
check_count += 1
puts "Threads: #{Thread.list.size}"
break if Thread.list.size == 1
pp Thread.list
if check_count > 10
Thread.list.each do |t|
pp t.backtrace
pp t.backtrace_locations
end
end
sleep 1
end
end
I generated a Java stack dump after we get into this and that one extra left over thread has no Java thread behind it anymore (also it does not seem to have a backtrace either). It is almost as if our cleanup did not remove it from some list?
BTW I just noticed my script uses String#truncate in the gsub block - its the Rails extension and I ripped this from my rails app code. Anyway this is never executed because the input string here will not pass the regexp.
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 24.71-b01 on 1.7.0_71-b14 +jit [mswin32-x86_64]
This came up in a rails 4.2 app but I think I have isolated the problem as having something to do with either JRuby threading or possibly the oniguruma lib.
When I execute this script, it will typically create and clean up threads as expected. Then usually after about 50 or more attempts, one of the threads gets stuck and does not end.
Example output:
Interestingly, running with --profile seems to cause the issue on attempt 0. See
https://gist.github.com/rob99/3caede73f6d3f1beaab7d379afd30775#file-thread_profile-txt
The text was updated successfully, but these errors were encountered: