Project

General

Profile

Actions

Patch #44265

closed

WebhookTest occasionally hangs

Added by Kenta Kumojima 25 days ago. Updated 18 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:

Description

Running ./bin/rails test occasionally hangs because WebhookTest never finishes.

This seems to happen in WebhookTest#with_webhook_server when server.shutdown is called before the thread calls server.start. In that case, thread.join then waits forever because the thread never exits.

The issue can be reproduced more reliably by adding a delay before server.start:

diff --git a/test/unit/webhook_test.rb b/test/unit/webhook_test.rb
index 9d0a83f49..4c09c104e 100644
--- a/test/unit/webhook_test.rb
+++ b/test/unit/webhook_test.rb
@@ -366,10 +366,16 @@ class WebhookTest < ActiveSupport::TestCase
       res.body = body
     end
     port = server.listeners.first.addr[1]
-    thread = Thread.new { server.start }
+    thread = Thread.new do
+      sleep 3
+      server.start
+    end
     yield port, received
$ ./bin/rails test test/unit/webhook_test.rb

Run options: --seed 58457

# Running:

(hangs indefinitely)

The attached patch prevents the test from hanging by forcibly terminating the thread if it does not exit within a reasonable amount of time.


Files

kill_webrick_server_thread.patch (687 Bytes) kill_webrick_server_thread.patch Kenta Kumojima, 2026-07-15 10:59
Actions #1

Updated by Katsuya HIDAKA 23 days ago

I confirmed that CI completed successfully with this patch on at least three separate runs. The patch looks good to me.

Since Redmine CI has been a bit unstable recently, I think we should merge this patch sooner rather than later.

Actions #2

Updated by Go MAEDA 23 days ago

  • Target version set to 7.0.1
Actions #3

Updated by Go MAEDA 20 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA

Committed the fix in r24854. Thank you.

Actions #4

Updated by Go MAEDA 18 days ago

  • Status changed from Resolved to Closed

Merged the fix into 7.0-stable branch.

Actions

Also available in: Atom PDF