librelist archives

« back to archive

Anyone having issues with Sidekiq + ActiveAdmin?

Anyone having issues with Sidekiq + ActiveAdmin?

From:
Thibaut Barrère
Date:
2014-05-18 @ 17:42
Hello,

When using Sidekiq (2.17.7) and ActiveAdmin (0.6.3) together, I get fairly
weird undefined classes exceptions (which appeared when using AA).

This happens:
- mainly when files in app/admin references ActiveRecord models
- /only/ when starting sidekiq via monit, outside the "current" folder (but
with a -r /xxx/current to tell sidekiq where the app is)

I know this is probably an exotic issue , but wondered if anyone here had
seen the same kind of problem?

I suspect the culprit is the fact that monit is executing sidekiq from
outside the "current" path and it seems to cause load issues.

Any hint will be most welcome!

thanks,

-- Thibaut

Re: [sidekiq] Anyone having issues with Sidekiq + ActiveAdmin?

From:
Mike Perham
Date:
2014-05-19 @ 11:03
Bizarre.  Yeah, I'd try "cd /var/app/current && bundle exec sidekiq" so
that no one gets confused that Rails.root is not the CWD.  If you're using
Upstart, you can set the CWD in the .conf.


On Sun, May 18, 2014 at 10:42 AM, Thibaut Barrère <thibaut.barrere@gmail.com
> wrote:

> Hello,
>
> When using Sidekiq (2.17.7) and ActiveAdmin (0.6.3) together, I get fairly
> weird undefined classes exceptions (which appeared when using AA).
>
> This happens:
> - mainly when files in app/admin references ActiveRecord models
> - /only/ when starting sidekiq via monit, outside the "current" folder
> (but with a -r /xxx/current to tell sidekiq where the app is)
>
> I know this is probably an exotic issue , but wondered if anyone here had
> seen the same kind of problem?
>
> I suspect the culprit is the fact that monit is executing sidekiq from
> outside the "current" path and it seems to cause load issues.
>
> Any hint will be most welcome!
>
> thanks,
>
> -- Thibaut
>
>
>


-- 
Mike Perham | mike@sidekiq.org

Re: [sidekiq] Anyone having issues with Sidekiq + ActiveAdmin?

From:
Thibaut Barrère
Date:
2014-05-19 @ 11:40
Hello Mike,

definitely bizarre, related to engines eager loading apparently!

Since one cannot do "cd" inside a monit start program clause (or I'd have
to use a wrapper script probably), I did fork sidekiq for now and did a
chdir at boot:


https://github.com/processone/sidekiq/commit/3ef625f997eadd63ac6c040c3cc50bcf96064391

This solves the issue for today.

We may move to upstart later on to avoid requiring this trick (and
maintaining our own fork), but in case, do you think the tweak would make
sense in sidekiq itself?

Let me know and if you want, I can issue a PR.

My repro is:
- use ActiveAdmin (I suspect any engine doing code loading tricks will have
the issue)
- rvm wrapper 2.0.0 bundle (I suspect this will also work without RVM, but
lack of time to install the full gemset)
- go to upper folder of the app
- launch with BUNDLE_GEMFILE=/path/to/app/Gemfile
~/.rvm/wrappers/ruby-2.0.0-p451@xyz/bundle exec sidekiq -r /path/to/app

thanks for your support,

-- Thibaut

Re: [sidekiq] Anyone having issues with Sidekiq + ActiveAdmin?

From:
Mike Perham
Date:
2014-05-19 @ 12:06
You could always do something like "bash -c 'cd /some/dir && exec bundle
exec sidekiq'"


On Mon, May 19, 2014 at 4:40 AM, Thibaut Barrère
<thibaut.barrere@gmail.com>wrote:

> Hello Mike,
>
> definitely bizarre, related to engines eager loading apparently!
>
> Since one cannot do "cd" inside a monit start program clause (or I'd have
> to use a wrapper script probably), I did fork sidekiq for now and did a
> chdir at boot:
>
>
> 
https://github.com/processone/sidekiq/commit/3ef625f997eadd63ac6c040c3cc50bcf96064391
>
> This solves the issue for today.
>
> We may move to upstart later on to avoid requiring this trick (and
> maintaining our own fork), but in case, do you think the tweak would make
> sense in sidekiq itself?
>
> Let me know and if you want, I can issue a PR.
>
> My repro is:
> - use ActiveAdmin (I suspect any engine doing code loading tricks will
> have the issue)
> - rvm wrapper 2.0.0 bundle (I suspect this will also work without RVM, but
> lack of time to install the full gemset)
> - go to upper folder of the app
> - launch with BUNDLE_GEMFILE=/path/to/app/Gemfile
> ~/.rvm/wrappers/ruby-2.0.0-p451@xyz/bundle exec sidekiq -r /path/to/app
>
> thanks for your support,
>
> -- Thibaut
>
>


-- 
Mike Perham | mike@sidekiq.org

Re: [sidekiq] Anyone having issues with Sidekiq + ActiveAdmin?

From:
Thibaut Barrère
Date:
2014-05-19 @ 12:34
> You could always do something like "bash -c 'cd /some/dir && exec bundle
> exec sidekiq'"
>

I will try that out to leave our fork, when I have a bit more time. Thanks!

-- Thibaut


>
>
> On Mon, May 19, 2014 at 4:40 AM, Thibaut Barrère <
> thibaut.barrere@gmail.com> wrote:
>
>> Hello Mike,
>>
>> definitely bizarre, related to engines eager loading apparently!
>>
>> Since one cannot do "cd" inside a monit start program clause (or I'd have
>> to use a wrapper script probably), I did fork sidekiq for now and did a
>> chdir at boot:
>>
>>
>> 
https://github.com/processone/sidekiq/commit/3ef625f997eadd63ac6c040c3cc50bcf96064391
>>
>> This solves the issue for today.
>>
>> We may move to upstart later on to avoid requiring this trick (and
>> maintaining our own fork), but in case, do you think the tweak would make
>> sense in sidekiq itself?
>>
>> Let me know and if you want, I can issue a PR.
>>
>> My repro is:
>> - use ActiveAdmin (I suspect any engine doing code loading tricks will
>> have the issue)
>> - rvm wrapper 2.0.0 bundle (I suspect this will also work without RVM,
>> but lack of time to install the full gemset)
>> - go to upper folder of the app
>> - launch with BUNDLE_GEMFILE=/path/to/app/Gemfile
>> ~/.rvm/wrappers/ruby-2.0.0-p451@xyz/bundle exec sidekiq -r /path/to/app
>>
>> thanks for your support,
>>
>> -- Thibaut
>>
>>
>
>
> --
> Mike Perham | mike@sidekiq.org
>

Re: [sidekiq] Anyone having issues with Sidekiq + ActiveAdmin?

From:
Thibaut Barrère
Date:
2014-06-02 @ 10:04
>
> You could always do something like "bash -c 'cd /some/dir && exec bundle
>> exec sidekiq'"
>>
>
Just a note - it indeed worked out just fine; I was using this somewhere
else in our monit setup but missed it for some reason.

Thanks for the reminder and your support!

-- Thibaut