Commit d90c296
authored
Attempted fix for urllib3 crashes (#10022)
We've still got an issue with crashes on the urllib3 requests test that
uses the mock HTTP server.
Fix #9958 to handle port mapping errors didn't resolve it.
I got a feeling there's an ordering issue. Looking at the error logs
[https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56500#c2](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56500#c2)
there appears to be an issue where we're throwing exceptions before the
coverage completes.
```
=== Uncaught Python exception: ===
--
| MaxRetryError: HTTPConnectionPool(host='localhost', port=8011): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4cdf33d1f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
| Traceback (most recent call last):
| File "fuzz_requests.py", line 109, in TestOneInput
| File "urllib3/_request_methods.py", line 118, in request
| File "urllib3/_request_methods.py", line 217, in request_encode_body
| File "urllib3/poolmanager.py", line 433, in urlopen
| File "urllib3/connectionpool.py", line 874, in urlopen
| File "urllib3/connectionpool.py", line 874, in urlopen
| File "urllib3/connectionpool.py", line 874, in urlopen
| File "urllib3/connectionpool.py", line 844, in urlopen
| File "urllib3/util/retry.py", line 505, in increment
| MaxRetryError: HTTPConnectionPool(host='localhost', port=8011): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4cdf33d1f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
|
| INFO: Instrumenting 3854 functions...
| INFO: Instrumentation complete.
| ==10674== ERROR: libFuzzer: fuzz target exited
| #0 0x7f4ce0bac694 in __sanitizer_print_stack_trace /src/llvm-project/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp:31:3
| #1 0x7f4ce0b2df48 in fuzzer::PrintStackTrace() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp:210:5
| #2 0x7f4ce0b12cdc in fuzzer::Fuzzer::ExitCallback() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:250:3
| #3 0x7f4ce09068a6 in __run_exit_handlers /build/glibc-SzIz7B/glibc-2.31/stdlib/exit.c:108:8
| #4 0x7f4ce0906a5f in exit /build/glibc-SzIz7B/glibc-2.31/stdlib/exit.c:139:3
| #5 0x7f4ce03b2c78 in libpython3.8.so.1.0
| #6 0x7f4ce03b76cf in libpython3.8.so.1.0
| #7 0x403ad2 in fuzz_requests.pkg
| #8 0x403e67 in fuzz_requests.pkg
| #9 0x7f4ce08e4082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
| #10 0x40249d in fuzz_requests.pkg
|
| SUMMARY: libFuzzer: fuzz target exited
```
This is an attempted fix inspired by the requests
[fuzz_server.py](https://github.com/google/oss-fuzz/blob/master/projects/requests/fuzz_server.py)
where the lifecycle of the test thread is managed within the server.
Since the web server is created at the start of `TestOneInput` I don't
expect there to be any timing issues or thread initialisation issues.1 parent cea7e49 commit d90c296
1 file changed
+58
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
| |||
69 | 64 | | |
70 | 65 | | |
71 | 66 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | | - | |
| 80 | + | |
84 | 81 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 82 | + | |
| 83 | + | |
119 | 84 | | |
120 | | - | |
121 | 85 | | |
122 | 86 | | |
123 | 87 | | |
124 | | - | |
125 | | - | |
126 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
127 | 92 | | |
128 | | - | |
129 | | - | |
| 93 | + | |
| 94 | + | |
130 | 95 | | |
131 | | - | |
| 96 | + | |
132 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| |||
0 commit comments