Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG: Unable to lock object] #3043

Closed
ghazel opened this issue May 22, 2014 · 3 comments
Closed

[BUG: Unable to lock object] #3043

ghazel opened this issue May 22, 2014 · 3 comments

Comments

@ghazel
Copy link
Contributor

ghazel commented May 22, 2014

Trying to reproduce #3025 I found another bug:

[BUG: Unable to lock object]
.ruby(_ZN8rubinius3bugEPKc+0x43) [0x5a03b3] 
ruby() [0x64c052] 
ruby(_ZN8rubinius5Class9auto_packEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x84) [0x688884] 
ruby(_ZN8rubinius5Class8allocateEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x3f2) [0x689ac2] 
ruby(_ZN8rubinius10Primitives14class_allocateEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xbc) [0x637a5c] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_17SplatOnlyArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+
0x280) [0x5fc300] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x16c1) [0x5bc281] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0
x21c) [0x5fa76c] 
ruby(_ZN8rubinius12CompiledCode16default_executorEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xc7) [0x68afa7] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4)
 [0x5fc6d4] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_12TwoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x2c4
) [0x5fb964] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4)
 [0x5fc6d4] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x298c) [0x5bd54c] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4)
 [0x5fc6d4] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x28a7) [0x5bd467] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_14ThreeArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x2
cc) [0x5fb46c] 
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x28a7) [0x5bd467] 
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0
x21c) [0x5fa76c] 
[0x7f535fdd68ad]                                                                                                 

My lame repro script (the idea is that Thread.raise is involved in the original bug because Net::HTTP uses Timeout.timeout)

require 'httparty'
require 'json'

class GCM
  include HTTParty
  PUSH_URL = 'https://android.googleapis.com/gcm/send'
  base_uri PUSH_URL
  default_timeout 30
  format :json

  def send
    params = {
      :body => {}.to_json,
      :headers => {
        'Content-Type' => 'application/json',
      }
    }
    response = self.class.post('', params)
  end
end

threads = []
10.times do
  threads << Thread.new do
    begin
      gcm = GCM.new
      loop do
        begin
          print '.'
          gcm.send.code
        rescue
        end
      end
    rescue
      retry
    end
  end
end

loop do 
  threads.each do |t|
    t.raise "foo"
  end
end
@ghazel
Copy link
Contributor Author

ghazel commented May 22, 2014

Another:

[BUG: Unable to lock object]
ruby(_ZN8rubinius3bugEPKc+0x43) [0x5a03b3]
ruby() [0x64c052]
ruby(_ZN8rubinius5Class9auto_packEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x84) [0x688884]
ruby(_ZN8rubinius5Class8allocateEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x3f2) [0x689ac2]
ruby(_ZN8rubinius10Primitives14class_allocateEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xbc) [0x637a5c]
ruby(_ZN8rubinius8CallSite19empty_cache_privateEPNS_5StateEPS0_PNS_9CallFrameERNS_9ArgumentsE+0x134) [0x6863c4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11OneArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x2bc) [0x5fbe4c]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11OneArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x2bc) [0x5fbe4c]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x298c) [0x5bd54c]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x298c) [0x5bd54c]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x28a7) [0x5bd467]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_14ThreeArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x2cc) [0x5fb46c]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x28a7) [0x5bd467]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x21c) [0x5fa76c]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25df) [0x5bd19f]
ruby(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x214) [0x682af4]
ruby(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x7d) [0x68324d]
ruby(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d) [0x68346d]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x3de5) [0x5be9a5]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x28a7) [0x5bd467]
ruby(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x214) [0x682af4]
ruby(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x7d) [0x68324d]
ruby(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d) [0x68346d]
ruby(_ZN8rubinius4Proc4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsE+0x34c) [0x6c811c]
ruby(_ZN8rubinius10Primitives9proc_callEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x8c) [0x61f74c]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x3211) [0x5bddd1]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_17SplatOnlyArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x280) [0x5fc300]
ruby(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x3211) [0x5bddd1]
ruby(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x1f4) [0x5fc6d4]
ruby(_ZN8rubinius8Dispatch4sendEPNS_5StateEPNS_9CallFrameERNS_10LookupDataERNS_9ArgumentsENS_19MethodMissingReasonE+0x6c) [0x5971ec]
ruby(_ZN8rubinius6Object4sendEPNS_5StateEPNS_9CallFrameEPNS_6SymbolEb+0xab) [0x6bc62b]
ruby(_ZN8rubinius6Thread13in_new_threadEPv+0x456) [0x6db296]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a) [0x7ffbb0b02e9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7ffbb001d3fd]

dbussink added a commit that referenced this issue May 30, 2014
This fixes a deadlock found running #3043. The deadlock occured when an
inflated header was being woken up and locked on the mutex_. This didn't
set the GC state properly so it would deadlock when a stop the world was
requested simultanuously.

This also fixes the hard_lock logic to retry if the locking sequence
gets interrupted. This is needed because we should not have interrupts
around that and have to defer the interrupt handling until after the
hard lock block.
@dbussink
Copy link
Contributor

Could you try if this still happens with current master? I haven't seen the crash anymore with current master but like to have someone confirm.

@yorickpeterse
Copy link
Contributor

Closing this, I can't reproduce this on the current master branch using the above script. Feel free to re-open if the issue still persits or re-manifests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants