Show backtrace for all Sidekiq threads
It might happen that your Sidekiq queue gets stuck, hanging at 0% CPU load.
When we inspected the process using strace
we saw a blocking select
system call.
You can get
backtraces for each thread
Show archive.org snapshot
by sending the TTIN
signal to the Sidekiq process like this:
kill -TTIN $process_id
Related cards:
Always show all form errors during development
You've been there: A form cannot be submitted, but you don't see a validation error because the field at fault has no corresponding input field on the form. Because this is usually a bug, you insert debug information listing all errors into the fo...
ExceptionNotification gem will only show application backtrace starting on Rails 4
Starting with Rails 4.0, when you get an exception reported via the ExceptionNotification
gem, you will only see a very short backtrace with all backtrace lines from gems or ruby libraries missing.
This happens, because the `ExceptionNotificati...
How to update RubyGems binary for all installed rubies
To update your Rubygems to the latest available version, type the following:
gem update --system
Note that you have a separate Rubygems installation for each Ruby version in your RVM or rbenv setup. Updating one does not update the others.
...
Rails + Sidekiq::Web: Configuration for wildcard session cookies
When you're using Sidekiq::Web
to monitor the Sidekiq status AND have your session cookie configured to a wildcard domain like .example.com
, you need to take an additional step to keep your cookies valid.
Issue
Sidekiq::Web
is mounted ...
How to implement simple queue limiting/throttling for Sidekiq
The sidekiq-rate-limiter gem allows rate-limiting Sidekiq jobs and works like a charm. However, it needs to be integrated on a per-worker basis.
If you want to limit a whole queue instead, and if y...
Devise: Invalidating all sessions for a user
Background information about session storage in Rails
Rails has a default mechanism to store the session in the [CookieStore
](https://api.rubyonrails.org/v7.0.8/classes/ActionD...
Adjust cron jobs to allow full backtraces for rake tasks
As we get an exception notification, when a cron job fails, we wish to have the full backtrace in this mail. A rake task doesn't output the full backtrace by default, so you need the --backtrace
option.
Trigger
You will find fail mails wit...
Install gems for all bundled projects
This is a bash script for those of you who need to install all gems for all projects (e.g. to get started quickly on a newly installed system).
Put it into your ~/bin/
and run it from the directory that holds your projects.
Note that, like the...
Rails: Have different session secrets for all environments
The Rails secret_token
must be unique for each application and any instance of it. If not, someone could exploit this by creating a user with ID = 1 (e.g. on staging), sign in and then use that cookie to authenticate on another site (e.g. on p...
postgresql: Get all values for an enum
SELECT enum_range(NULL::portal) # Returns an array of all possible values
SELECT unnest(enum_range(NULL::portal)) # Unnests the array and returns a row for each value
Whereas portal is the enum type.