-
Notifications
You must be signed in to change notification settings - Fork 310
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
Deadlocks in Rails Console #1826
Comments
This seems to happen specifically when I access a class for the first time, and I see the The listen threads seem to be under I'm a bit out of my depth. I upgraded instant client but I can still cause the deadlocks. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still a problem stale bot. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
:( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Steps to reproduce
With the Rails console open, try loading a record with something like
Model.find 123
This is tricky because it doesn't happen for every DB access, certainly doesn't happen for everyone using this tool, and only occurs in development mode in the console.
Expected behavior
I should get a record from the database.
Actual behavior
CPU usage spikes, console sits forever, stuck.
Edit: I initially thought it dropped back down but that was just me attaching the debugger and pausing execution.
System configuration
Rails version: 5.1.6.1
Oracle enhanced adapter version: 1.8.2
Ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
Oracle Database version: 11g
I'm not convinced this is entirely the fault of Oracle enhanced. I grabbed some stack traces and the main thread is blocked on a system call:
#1 0x0000000115b18e1f in nttfprd () from .../instantclient_12_1/libclntsh.dylib.12.1
However, once I tried to interact with Ruby using
gdb
I caused a segfault and accidentally got the Ruby stack trace I was looking for the ugly way:That to me reads like listen is at least involved here, but this only locks up when I make a call to the database. This happens just about every time I launch a Rails console, but it doesn't seem to happen with Rails server or through ActiveJob.
Here is a gist with the actual traces. One is a flat trace I grabbed from gdb where you can see the call in instantclient at the top of the main thread.
The output from
sample
is annoyingly noisy, but you can see the call tothread_pool
which is what I believe was at the top of the Ruby stack trace. Down at the leaves of that call tree there is an awful lot of_pthread_mutex_lock_wait
which I think is called here where the interpreter is trying to acquire the VM lock.I'm also going to try swapping out my version of Oracle Instant Client and see if that helps.
The text was updated successfully, but these errors were encountered: