Menu

#767 esniper segfaults on OpenBSD 6.4

v1.0 (example)
closed-fixed
None
2
2019-03-10
2019-02-01
No

Hello,

This does not happen evey time, but the easiest way to replicate it is to ask for the watchlist. You should be able to replicate it in 3-4 tries.

(gdb) run
Starting program: /usr/ports/pobj/esniper-2.35.0/esniper-2-35-0/esniper -m

Program received signal SIGSEGV, Segmentation fault.
strlen () at /usr/src/lib/libc/arch/amd64/string/strlen.S:125
125     /usr/src/lib/libc/arch/amd64/string/strlen.S: No such file or directory.
        in /usr/src/lib/libc/arch/amd64/string/strlen.S
Current language:  auto; currently asm
(gdb) bt
#0  strlen () at /usr/src/lib/libc/arch/amd64/string/strlen.S:125
#1  0x000004a2edf3e9e5 in Curl_pretransfer (data=0x4a270901008) at transfer.c:1406
#2  0x000004a2edf4eb9a in multi_runsingle (multi=0x4a2b2eb7808, now={tv_sec = 96041, tv_usec = 578763},
    data=0x4a270901008) at multi.c:1441
#3  0x000004a2edf4e3ca in curl_multi_perform (multi=0x4a2b2eb7808, running_handles=0x7f7ffffdc48c) at multi.c:2214
#4  0x000004a2edf41d25 in easy_transfer (multi=0x4a2b2eb7808) at easy.c:686
#5  0x000004a2edf4074e in easy_perform (data=0x4a270901008, events=false) at easy.c:780
#6  0x000004a2edf40563 in curl_easy_perform (data=0x4a270901008) at easy.c:799
#7  0x000004a0606dae68 in httpRequest (
    url=0x4a343e38880 "https://my.ebay.com/ws/eBayISAPI.dll?MyeBay&CurrentPage=MyeBayWatching", logUrl=0x0,
    data=0x4a0606c9a49 "", logData=0x0, rt=GET) at http.c:177
#8  0x000004a0606dab7a in httpGet (
    url=0x4a343e38880 "https://my.ebay.com/ws/eBayISAPI.dll?MyeBay&CurrentPage=MyeBayWatching", logUrl=0x0)
    at http.c:79
#9  0x000004a0606cfdec in printMyItems () at auction.c:1217
#10 0x000004a0606d4df2 in main (argc=0, argv=0x7f7ffffdc858) at esniper.c:850 

Discussion

  • Renaud Allard

    Renaud Allard - 2019-02-01

    It seems this patch solves those crashes, but the issue must be deeper

    --- http.c.orig Sun Jun 17 19:26:57 2018
    +++ http.c      Fri Feb  1 15:24:53 2019
    @@ -162,8 +162,10 @@
                    return httpRequestFailed(mp);
    
            if (rt == GET) {
    
    -               if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, 1)))
    +               if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDSIZE, 0)))
                            return httpRequestFailed(mp);
    +               if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, 1L)))
    +                       return httpRequestFailed(mp);
            } else {
                    log(("%s", logData ? logData : nonNullData));
                    if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, nonNullData)))
    
     
  • Michael S.

    Michael S. - 2019-02-01

    The reason must be a wrong implementation of libcurl easy in BSD.
    If a http GET request is used, there is no need to set options dealing with POST.

     
  • Renaud Allard

    Renaud Allard - 2019-02-01

    libcurl is the same as on linux, there is no specific one for BSD. I made this change because the segfault was in a httpGet request but using some post options in libcurl. Why is POST called in GET, I have no idea, I would need to understand the whole code of esniper to find that. Hence why I opened the bug report, there is something wrong somewhere, but I have not enough experience in libcurl or esniper to find it.
    Besides, "esniper -m" always ends without any result, even if there are some tings in my watch list. So there is clearly some issue deeper somewhere here.

     
  • Michael S.

    Michael S. - 2019-02-09

    The libcurl-easy API is used according to documentation (https://curl.haxx.se/libcurl/c/libcurl-easy.html). Maybe you should submit a bug at https://github.com/curl/curl/issues.

     
  • Renaud Allard

    Renaud Allard - 2019-02-11
     
  • Renaud Allard

    Renaud Allard - 2019-02-11

    It seems the answer from curl people is mixed.

    If you set an option like CURLOPT_POSTFIELDS to point to something bad, I don't think you should assume that libcurl won't use it simply because you have also set CURLOPT_HTTPGET.

    I agree that ideally libcurl should just ignore that pointer in this case, but I don't think that's a good reason for an application to keep a stale pointer set for curl. PR coming up.

     
  • Michael S.

    Michael S. - 2019-02-11

    The reason for the seg. fault in BSD seems to be a stale pointer (https://github.com/curl/curl/issues/3548). We need to add the 2 lines submitted by Renaud Allard above. For me it makes no sense to set a pointer, which is only be used by the POST-method, but we depend on curllib and their maintainers.

     
  • Michael S.

    Michael S. - 2019-02-12

    Seems to be fixed in curl:a6d134e

    Commit [89bd41] fixes the bug as long as no new version of libcurl is available in the used distro.
    But the 2 lines of additional code will not have much influence on the speed of esniper.

     

    Related

    Commit: [89bd41]

  • Michael S.

    Michael S. - 2019-03-10
    • status: open --> closed-fixed
    • assigned_to: Michael S.
     

Log in to post a comment.

MongoDB Logo MongoDB