Bug#855118: wrk: only loops and burns CPU
Christos Trochalakis wrote: > I plan to upload it as an nmu on Monday unless Robert wants to prepare > the upload himself. I have just pushed those fixes to the packaging repo > (nmu branch). > > https://anonscm.debian.org/cgit/collab-maint/wrk.git/log/?h=nmu Thanks, just uploaded these changes as 4.0.2-2. -- Robert Edmonds edmo...@debian.org
Bug#855118: wrk: only loops and burns CPU
On Tue, Aug 01, 2017 at 02:10:18AM +0300, Rinat Ibragimov wrote: Hi. Looks like patch intended to fix FTBFS was wrong. And rendered wrk unusable. One can't just replace __sync_val_compare_and_swap by __atomic_compare_exchange without other changes, since former function returns previous value of the atomic variable, while latter returns a boolean value. True for success. Placing that value into "max" starts a infinite loop if n was larger than 1, which is almost always. Proposed patch attached. I have also confirmed that the above patch fixes the busy-loop issue. I have prepared an upload that fixes this bug by including your patch and correctly handles the mips FTBFS (#801881). I plan to upload it as an nmu on Monday unless Robert wants to prepare the upload himself. I have just pushed those fixes to the packaging repo (nmu branch). https://anonscm.debian.org/cgit/collab-maint/wrk.git/log/?h=nmu
Bug#855118: wrk: only loops and burns CPU
Hi. Looks like patch intended to fix FTBFS was wrong. And rendered wrk unusable. One can't just replace __sync_val_compare_and_swap by __atomic_compare_exchange without other changes, since former function returns previous value of the atomic variable, while latter returns a boolean value. True for success. Placing that value into "max" starts a infinite loop if n was larger than 1, which is almost always. Proposed patch attached. --- Rinatdiff -urN wrk-4.0.2-prev/src/stats.c wrk-4.0.2/src/stats.c --- wrk-4.0.2-prev/src/stats.c 2017-08-01 01:35:38.0 +0300 +++ wrk-4.0.2/src/stats.c 2017-08-01 01:57:00.900436161 +0300 @@ -25,8 +25,17 @@ __atomic_fetch_add(>count, 1, __ATOMIC_SEQ_CST); uint64_t min = stats->min; uint64_t max = stats->max; -while (n < min) min = __atomic_compare_exchange(>min, , , false,__ATOMIC_SEQ_CST,__ATOMIC_SEQ_CST); -while (n > max) max = __atomic_compare_exchange(>max, , , false,__ATOMIC_SEQ_CST,__ATOMIC_SEQ_CST); +while (n < min) { +__atomic_compare_exchange(>min, , , false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +min = stats->min; +} +while (n > max) { +__atomic_compare_exchange(>max, , , false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +max = stats->max; +} + return 1; }
Bug#855118: wrk: only loops and burns CPU
Package: wrk Version: 4.0.2-1+b1 Severity: normal This version of "wrk" is broken. Running it eg. via # wrk http://127.0.0.1:3309/static just makes it loop and burn some CPU; it never terminates, and doesn't even do many HTTP requests. Version 4.0.1-2 (from yakkety) works as expected. -- System Information: Debian Release: 9.0 APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages wrk depends on: ii libc62.24-9 ii libluajit-5.1-2 2.0.4+dfsg-1 ii libssl1.11.1.0d-2 wrk recommends no packages. wrk suggests no packages. -- no debconf information