Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stat & TestCLI#test_control_for_tcp #1470

Merged
merged 1 commit into from
Dec 11, 2017

Conversation

MSP-Greg
Copy link
Member

No description provided.

@MSP-Greg
Copy link
Member Author

@nateberkopec

Thought an explanation might be helpful, as I don't know puma that well. Most of the intermittent failures originally fail with something like the following:

TestCLI#test_control_for_tcp = [MinitestRetry] retry 'test_control_for_tcp' count: 1,  msg: --- expected
+++ actual
@@ -1 +1,2 @@
-"{ \"backlog\": 0, \"running\": 0 }"
+# encoding: ASCII-8BIT
+"{ \"backlog\": , \"running\":  }"

The output shown at the bottom of the log is the retry info. So, from the above, we see two things:

  1. The split command is not working in /test/test_cli.rb. Hence, the change from "\r\n" to /\r?\n/ for the delimiter.

  2. The last line has no zeros. The backlog and running attributes from lib/puma/server.rb are shown below:

    def backlog
      @thread_pool and @thread_pool.backlog
    end

    def running
      @thread_pool and @thread_pool.spawned
    end

That code shows that @thread_pool may be nil, and hence, the return will either be nil or a number >= 0. Hence, the added || 0 code to lib/puma/cluster.rb and lib/puma/single.rb for their 'stats' info.

This fixes the issue with the test, but I don't know if the test code should generate a non nil value for @thread_pool, and hence there really is an issue... Thanks, Greg

@nateberkopec nateberkopec merged commit 5a6f3f2 into puma:master Dec 11, 2017
@MSP-Greg MSP-Greg deleted the stat_and_test_fix branch April 24, 2019 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants