Skip to content

better_errors gem doesn't work correctly

Summary

GitLab uses the better_errors gem to render an interactive stacktrace and console in the browser when an exception is raised in development.

Unfortunately this doesn't always work correctly and returns an error No exception information available or Session expired.

This can happen when rendering the initial error page:

image

Or when using the console:

image

Or when navigating the stacktrace:

image

Steps to reproduce

  1. Run the GitLab Rails application with RAILS_ENV=development
  2. Add code to raise an exception in a controller action (e.g. raise 'foo')
  3. Navigate to the action
  4. If you don't see the error message, reload or try one of the actions above

What is the current bug behavior?

Some requests are aborted with an error.

What is the expected correct behavior?

All actions work as expected.

Relevant logs and/or screenshots

Output of checks

This bug only happens in the development environment, as the gem is not loaded in production.

Possible fixes

This is a general limitation when using multi-process servers, and the web-console gem has the same limitation.

Now that we're on Puma maybe we can use one worker process with threads only? I tried setting workers 1 (2 by default) in config/puma.rb and with that better_errors seems to work reliably.

Edited by Markus Koller