Commit be6ff63
fix: ensure connection is reset if from_http_response raises an exception (#15559)
## Description
Previously, the http writer was calling `from_http_response` in the
`else` block of the exception handler that does the request, set's the
log level, et cetera. However this could have the problem of
`from_http_response` itself raising an exception (e.g.
`http.client.IncompleteRead` as seen on dogweb staging recently) outside
of the `Exception` handler, which would leave the `HTTPWriter` object in
need of a call to `_reset`; the `finally` would call `_reset` but only
if `reuse_connection` aka `DD_TRACE_WRITER_REUSE_CONNECTIONS` was
enabled, which is not the default.
## Testing
New tests have been added.
## Risks
<!-- Note any risks associated with this change, or "None" if no risks
-->
## Additional Notes
<!-- Any other information that would be helpful for reviewers -->
---------
Signed-off-by: Juanjo Alvarez <[email protected]>
Co-authored-by: Quinna Halim <[email protected]>1 parent a15452f commit be6ff63
File tree
3 files changed
+51
-2
lines changed- ddtrace/internal/writer
- releasenotes/notes
- tests/tracer
3 files changed
+51
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
290 | | - | |
291 | | - | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
754 | 775 | | |
755 | 776 | | |
756 | 777 | | |
757 | 778 | | |
| 779 | + | |
758 | 780 | | |
759 | 781 | | |
760 | 782 | | |
| |||
827 | 849 | | |
828 | 850 | | |
829 | 851 | | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
830 | 862 | | |
831 | 863 | | |
832 | 864 | | |
| |||
899 | 931 | | |
900 | 932 | | |
901 | 933 | | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
902 | 945 | | |
903 | 946 | | |
904 | 947 | | |
| |||
0 commit comments