Debug Ruby RSpec Test Timeout With No Output (exceeded 10m0s): context deadline exceeded

Display Stack Trace and Test Progress

When a test times out in CircleCI with no output, it can be frustrating.
The following method can be used to obtain a stack trace at a defined interval during RSpec tests:

First, add the code snippet listed as directed in this Github Issues comment.

Then add this run step, just above your RSpec tests:

- run:
background: true
command: |
while true ; do
sleep 15
num=$(ps a | grep rspec | grep -v grep | awk '{print $1}')
echo "Process num: $num"
echo "Sending signal"
kill -USR1 ${num} || true

This will send the signal to display the stack trace and allow additional visibility into the test progress.

Note: Because this job will send repeated stack traces then if the job hangs it may not stop after 10 minutes. If you make use of this technique, please be sure to monitor the build in progress.
If you need to run the job multiple times and cannot monitor it, consider making use of a tool such as the fernfernfern/stopthatjob Orb to stop the entire job after a specified amount of time. Otherwise, the job could potentially run for 5 hours before stopping.


Additional Resources:

Was this article helpful?
0 out of 4 found this helpful



Article is closed for comments.