Skip to content

http-lib: add backtrace to logs on connection without response #6028

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

Merged
merged 6 commits into from
Oct 10, 2024

Conversation

psafont
Copy link
Member

@psafont psafont commented Oct 1, 2024

Some long-running migrations stop because of a loss of connection, log more information when it happens.

I couldn't find a way to get the backtrace to be printed in a nice way without adding too much code, this also makes the change backportable.

I would prefer to log it at a debug level, but the function doesn't expose it, and it would complicate backpoerting as well.

@psafont psafont requested a review from edwintorok October 1, 2024 13:09
@psafont
Copy link
Member Author

psafont commented Oct 1, 2024

Backport at xapi-project/xen-api-libs-transitional#117

@snwoods snwoods self-requested a review October 3, 2024 13:44
@psafont psafont marked this pull request as draft October 4, 2024 13:11
@psafont
Copy link
Member Author

psafont commented Oct 4, 2024

I'm changing the tests around the http client and server to try to test this change

@psafont psafont force-pushed the logconn branch 3 times, most recently from 9b5060a to a757166 Compare October 7, 2024 16:00
@psafont psafont requested review from robhoes, snwoods and lindig October 7, 2024 16:01
@psafont psafont marked this pull request as ready for review October 7, 2024 16:01
@psafont
Copy link
Member Author

psafont commented Oct 7, 2024

Note that the D.Debug is not printed in the default configuration, but the backtraces will be printed. I believe this should not not usually cause logspam as connections are only established to known servers, so parse error (and other unknown exceptions) should be rare in practice/

(package xapi)
(deps
test_client.exe
test_server.exe
client_server_test.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does it find the new test_client_server.t?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cram atom processes all the .t files in the directory

Gives more flexibility in tests. Now the results from the client aren't
printed, but weren't important to pass the test anyway.

Signed-off-by: Pau Ruiz Safont <[email protected]>
Current behaviour for displaying stats is done with the --perf parameter

Signed-off-by: Pau Ruiz Safont <[email protected]>
While this does not exercise the exact error that can happen in long
migrations, it gets logged in a similar way.

There's no easy way to trigger the issue, the best chance is to send a
malformed response to trigger a Parse_error.

I did modify the code in http_client and verified that current code can produce
the logging, with backtraces successfully, when set up properly (like in the
test client)

Signed-off-by: Pau Ruiz Safont <[email protected]>
No functional difference

Signed-off-by: Pau Ruiz Safont <[email protected]>
Taking measurements in practice doesn't lead to improved accuracy. Also change
the tests so more than one sample is collected and can know how noisy the
measurements really are.

Here's an example of a run, including the result before the change:

```
   $ ./test_client.exe --perf
-  1 thread non-persistent connections:        4896.0 +/- 0.0 RPCs/sec
-  1 thread non-persistent connections (query):        4811.0 +/- 0.0 RPCs/sec
-  10 threads non-persistent connections: 7175.0 +/- 0.0 RPCs/sec
-  1 thread persistent connection:             16047.0 +/- 0.0 RPCs/sec
-  10 threads persistent connections: 7713.0 +/- 0.0 RPCs/sec
+  1 thread non-persistent connections:         5042.0 +/- 247.5 RPCs/sec
+  1 thread non-persistent connections (query): 5173.0 +/- 216.0 RPCs/sec
+  10 threads non-persistent connections:       7678.0 +/- 2241.2 RPCs/sec
+  1 thread persistent connection:              21814.0 +/- 2124.6 RPCs/sec
+  10 threads persistent connections:           10154.0 +/- 2461.9 RPCs/sec
```

Signed-off-by: Pau Ruiz Safont <[email protected]>
@psafont psafont added this pull request to the merge queue Oct 10, 2024
Merged via the queue into xapi-project:master with commit 59ea7bc Oct 10, 2024
15 checks passed
@psafont psafont deleted the logconn branch October 10, 2024 10:54
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.

4 participants