[ruby-core:89217] [Ruby trunk Bug#15130] open-uri hangs on cygwin

From: duerst@...
Date: 2018-09-30 09:08:12 UTC
List: ruby-core #89217
Issue #15130 has been updated by duerst (Martin D端rst).


normalperson (Eric Wong) wrote:

Eric, many thanks for your answers, and sorry to be late with my replies.

>  If you don't hit Ctrl-C, what is the CPU usage of that script?
>  (from top(1) or similar tools)

Using the Windows Task Manager, it's 0.0%.

>  Also, that would be a good time to attach "strace -f -p <PID>"
>  and see what is going on.  Thanks

Here is what I get:

```
$ strace -f -p 21772
--- Process 14556 created
--- Process 14556 loaded C:\Windows\System32\ntdll.dll at 00007ffaccec0000
--- Process 14556 thread 20116 created
--- Process 14556 thread 14344 created
--- Process 14556 thread 10272 created
--- Process 14556 loaded C:\Windows\System32\kernel32.dll at 00007ffacbef0000
--- Process 14556 loaded C:\Windows\System32\KernelBase.dll at 00007ffaca420000
--- Process 14556 loaded C:\systems\cygwin64\usr\local\bin\cygruby260.dll at 00000005ed550000
--- Process 14556 loaded C:\systems\cygwin64\bin\cygwin1.dll at 0000000180040000
--- Process 14556 loaded C:\systems\cygwin64\bin\cyggcc_s-seh-1.dll at 00000003ff540000
--- Process 14556 loaded C:\Windows\System32\user32.dll at 00007ffacc910000
--- Process 14556 loaded C:\Windows\System32\gdi32.dll at 00007ffacc690000
--- Process 14556 loaded C:\Windows\System32\advapi32.dll at 00007ffacc1d0000
--- Process 14556 loaded C:\Windows\System32\msvcrt.dll at 00007ffaccc70000
--- Process 14556 loaded C:\Windows\System32\sechost.dll at 00007ffacc620000
--- Process 14556 loaded C:\Windows\System32\rpcrt4.dll at 00007ffaca6a0000
--- Process 14556 loaded C:\Windows\System32\sspicli.dll at 00007ffaca290000
--- Process 14556 loaded C:\Windows\System32\cryptbase.dll at 00007ffac9eb0000
--- Process 14556 loaded C:\Windows\System32\bcryptprimitives.dll at 00007ffac9e40000
--- Process 14556 loaded C:\Windows\System32\imm32.dll at 00007ffacc5e0000
--- Process 14556 loaded C:\Windows\System32\msctf.dll at 00007ffaca540000
--- Process 14556 loaded C:\systems\cygwin64\usr\local\lib\ruby\2.6.0\x86_64-cygwin\enc\encdb.so at 00000004b1d30000
--- Process 14556 loaded C:\systems\cygwin64\usr\local\lib\ruby\2.6.0\x86_64-cygwin\enc\trans\transdb.so at 000000040b2f0000
--- Process 14556 loaded C:\systems\cygwin64\usr\local\lib\ruby\2.6.0\x86_64-cygwin\stringio.so at 0000000587b40000
--- Process 14556 loaded C:\Windows\System32\authz.dll at 00007ffac9210000
--- Process 14556 thread 14032 created
--- Process 14556 thread 14032 exited with status 0x0
    1       1 [sig] ruby 21772 **********************************************
   84      85 [sig] ruby 21772 Program name: C:\systems\cygwin64\usr\local\bin\ruby.exe (pid 21772, ppid 632,windows pid 14556)
   50     135 [sig] ruby 21772 OS version:   Windows NT-6.3
   34     169 [sig] ruby 21772 **********************************************
```

This then also 'hangs', with CPU usage 0.0%. My understanding would be that this means that `strace` doesn't have much to show because there's nothing going on on the Ruby side.


----------------------------------------
Bug #15130: open-uri hangs on cygwin
https://bugs.ruby-lang.org/issues/15130#change-74244

* Author: duerst (Martin D端rst)
* Status: Open
* Priority: Normal
* Assignee: normalperson (Eric Wong)
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-09-16 trunk 64761) [x86_64-cygwin]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
After using `make; make runnable`, the following one-liner hangs:

```
 ./ruby -ropen-uri -e 'open "http://web.mit.edu/index.html"'
```

This happens on any http URI, but not for local files. The above URI is just an example. I would have chosen ruby-lang.org if it was still using http, but I didn't want to complicate this with https.

The `open` work for local files. I discovered this when trying to use `make up`, where the downloading of Unicode data files just hung.

Here's the trace I get after hitting Ctrl-C:

Traceback (most recent call last):
        15: from -e:1:in `<main>'
        14: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:35:in `open'
        13: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:736:in `open'
        12: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:165:in `open_uri'
        11: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:224:in `open_loop'
        10: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:224:in `catch'
         9: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:226:in `block in open_loop'
         8: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:758:in `buffer_open'
         7: from /cygdrive/c/Data/ruby_test_copy/lib/open-uri.rb:337:in `open_http'
         6: from /cygdrive/c/Data/ruby_test_copy/lib/net/http.rb:924:in `start'
         5: from /cygdrive/c/Data/ruby_test_copy/lib/net/http.rb:935:in `do_start'
         4: from /cygdrive/c/Data/ruby_test_copy/lib/net/http.rb:950:in `connect'
         3: from /cygdrive/c/Data/ruby_test_copy/lib/timeout.rb:103:in `timeout'
         2: from /cygdrive/c/Data/ruby_test_copy/lib/timeout.rb:97:in `block in timeout'
         1: from /cygdrive/c/Data/ruby_test_copy/lib/timeout.rb:97:in `ensure in block in timeout'
/cygdrive/c/Data/ruby_test_copy/lib/timeout.rb:97:in `join': Interrupt

My plan is to (manually) bisect this to find the offending commit. One suspicion I have is that the problem is related to timeouts, but this is not confirmed at all. Any help is appreciated.

---Files--------------------------------
0001-thread_pthread.c-fall-back-to-UBF_TIMER_PTHREAD-for-.patch (1.29 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next