-
Notifications
You must be signed in to change notification settings - Fork 159
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
NameError: instance variable @sequence_name not defined #81
Comments
You are running 2.6.1 which is not the latest but the issue should still be happening on the latest version as that particular piece of code has not changed.
on a sidekiq worker. Is that the case? looking at apartment gem itself, we're trying to reset the sequence names without hitting the database, but that does not explain why your code would break we are selecting explicitly active record descendants that have that instance variable. |
Yeah, it's odd. I'm processing millions and millions of background jobs every day, where I start every job by switching schema (similar to the middleware plugin for sidekiq), and the problem only occurred a few times in total. Here is the latest trace from Honeybadger:
Any idea how I could further debug this? |
I'm as puzzled as you are. Can you somehow make it happen locally? e.g I can prepare a branch from your current version and add this line and you can check if it fixes it? would that help? |
If you can, please run this branch: https://github.com/rails-on-services/apartment/tree/test-reported-issue-81 |
For now we'll be avoiding the error by checking for the instance variable existence before removal. The only situation that i can think of is that somehow in a parallel execution the variable has been removed an not yet re-calculated thus throwing the error. I'll be investigating further the details of the implementation and see if there is a better longer term solution to avoid this whole logic in the first place |
sequence_name is shared across threads because it is stored in a class ivar. This means that on threaded servers, the sequence_name might point to a different tenant, if another tenant made the switch at the right time. This race is likely the cause of rails-on-services#81 as well. This reverts commit f8eefc4.
sequence_name is shared across threads because it is stored in a class ivar. This means that on threaded servers, the sequence_name might point to a different tenant, if another tenant made the switch at the right time. This race is likely the cause of rails-on-services#81 as well. This reverts commit f8eefc4.
sequence_name is shared across threads because it is stored in a class ivar. This means that on threaded servers, the sequence_name might point to a different tenant, if another tenant made the switch at the right time. This race is likely the cause of rails-on-services#81 as well. This reverts commit f8eefc4.
**Implemented enhancements:** - Increase errors visibility by showing more information on the underlying error rather than a generic error 'Apartment::TenantNotFound' (#176) - Resolved #177 - Added rails 7 support (#178) **Fixed bugs:** - Fixing tenant_presence_check config in the README (#180) - Resolved #161 and #81 - Fixed sequence name (#187) **Closed issues:** - Resolved #151 - removed reloader and console overwrite of reload method (#174)
After upgrading to ros-apartment from apartment, I get the above error at times:
Rails 5.2 and latest ros-apartment from rubygems.
Any idea what it could be?
The text was updated successfully, but these errors were encountered: