Skip to content

OSX: rust runtime hangs doing tcp messaging #9201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glycerine opened this issue Sep 15, 2013 · 1 comment
Closed

OSX: rust runtime hangs doing tcp messaging #9201

glycerine opened this issue Sep 15, 2013 · 1 comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows O-macos Operating system: macOS

Comments

@glycerine
Copy link

version:

macbook-pro-2:~/dev/rust-nanomsg$ rustc -v
rustc 0.8-pre (bb35e23 2013-08-30 21:40:32 -0700)
host: x86_64-apple-darwin

Note: The test below works fine on Linux.

However under OSX 10.6.8 and 10.8.x the following procedure reliably hangs. This happens under nanocli, a small, easily readable, test program that uses the nanomsg library from rust. The location of the hang appears to be in calls originating from the rust runtime (see stacktrace of thread 1 below in the gdb session).

  1. preparation: install nanomsg
cd /tmp; git clone https://github.com/nanomsg/nanomsg;
cd nanomsg; ./autogen.sh; ./configure; make && sudo make install
sudo ldconfig
  1. clone the rust-nanogen repo
cd /tmp; git clone https://github.com/glycerine/rust-nanomsg;
cd rust-nanomsg; 
/// if necessary git checkout 5008431df8807beb860ba8728ad7f4b8bd7db216 # if it isn't the head. The test below is drawn from nanoserv.rs and nanocli.rs as of 2013 Sept 9. 
make clean; make
  1. start server
./nanoserv &
  1. start client. Instead of finishing successfully, the client hangs after send and first receive, never getting its second receive
./nanocli
macbook-pro-2:~/dev/rust-nanomsg$ ./nanoserv &
[1] 21774
macbook-pro-2:~/dev/rust-nanomsg$ server binding to '"tcp://127.0.0.1:5555"'
nn_socket returned: 0i32

macbook-pro-2:~/dev/rust-nanomsg$ ./nanocli 
client binding to '"tcp://127.0.0.1:5555"'
client: I sent 'WHY'
server: I received a 3 byte long msg: 'WHY'
server: I sent 'LUV'
server: 2nd send, I sent 'CAT'

the client hangs. Using gdb we can see that it is waiting on a semaphore (thread 1).

macbook-pro-2:~/dev/rust-nanomsg$ gdb ./nanocli
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin10.8.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/me/dev/rust-nanomsg/nanocli...Reading symbols from /Users/me/dev/rust-nanomsg/nanocli.dSYM/Contents/Resources/DWARF/nanocli...done.
done.
(gdb) run
Starting program: /Users/me/dev/rust-nanomsg/nanocli 
client binding to '"tcp://127.0.0.1:5555"'
client: I sent 'WHY'
(hung; press ctrl-c)
  C-c C-c[New Thread 0x1903 of process 21221]
[New Thread 0x1a03 of process 21221]
[New Thread 0x1b03 of process 21221]
[New Thread 0x1c03 of process 21221]
[New Thread 0x1d03 of process 21221]

Program received signal SIGINT, Interrupt.
0x00007fff849f9a6a in __semwait_signal () from /usr/lib/libSystem.B.dylib
(gdb) i th
  Id   Target Id         Frame 
  6    Thread 0x1d03 of process 21221 0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
  5    Thread 0x1c03 of process 21221 0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
  4    Thread 0x1b03 of process 21221 0x00007fff84a41d62 in poll () from /usr/lib/libSystem.B.dylib
  3    Thread 0x1a03 of process 21221 0x00007fff849bed7a in mach_msg_trap ()
   from /usr/lib/libSystem.B.dylib
  2    Thread 0x1903 of process 21221 0x00007fff849bed7a in mach_msg_trap ()
   from /usr/lib/libSystem.B.dylib
* 1    Thread 0x1703 of process 21221 0x00007fff849f9a6a in __semwait_signal ()
   from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849f9a6a in __semwait_signal () from /usr/lib/libSystem.B.dylib
#1  0x00007fff84a20896 in pthread_join () from /usr/lib/libSystem.B.dylib
#2  0x0000000100602b50 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#3  0x000000010009e7a6 in rt::thread::__extensions__::meth_23418::join::_f3525925b944a51::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#4  0x0000000100120b8c in rt::run_::_82e8c355ab8d949f::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#5  0x00000001000d00eb in unstable::lang::start::_76d6c774aa357c7a::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#6  0x000000010000db2b in main ()
(gdb) thr 2
[Switching to thread 2 (Thread 0x1903 of process 21221)]
#0  0x00007fff849bed7a in mach_msg_trap () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849bed7a in mach_msg_trap () from /usr/lib/libSystem.B.dylib
#1  0x00007fff849bf3ed in mach_msg () from /usr/lib/libSystem.B.dylib
#2  0x00007fff89d7a902 in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#3  0x00007fff89d79d8f in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#4  0x00007fff89d79b16 in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#5  0x000000010061c793 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#6  0x000000010061aee8 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#7  0x00007fff849f7fd6 in _pthread_start () from /usr/lib/libSystem.B.dylib
#8  0x00007fff849f7e89 in thread_start () from /usr/lib/libSystem.B.dylib
#9  0x0000000000000000 in ?? ()
(gdb) thr 3
[Switching to thread 3 (Thread 0x1a03 of process 21221)]
#0  0x00007fff849bed7a in mach_msg_trap () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849bed7a in mach_msg_trap () from /usr/lib/libSystem.B.dylib
#1  0x00007fff849bf3ed in mach_msg () from /usr/lib/libSystem.B.dylib
#2  0x00007fff89d7a902 in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#3  0x00007fff89d79d8f in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#4  0x00007fff89d79b16 in ?? ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#5  0x000000010061c793 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#6  0x000000010061aee8 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#7  0x00007fff849f7fd6 in _pthread_start () from /usr/lib/libSystem.B.dylib
#8  0x00007fff849f7e89 in thread_start () from /usr/lib/libSystem.B.dylib
#9  0x0000000000000000 in ?? ()
(gdb) thr 4
[Switching to thread 4 (Thread 0x1b03 of process 21221)]
#0  0x00007fff84a41d62 in poll () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff84a41d62 in poll () from /usr/lib/libSystem.B.dylib
#1  0x00000001005ce064 in nn_efd_wait (self=0x10136a370, timeout=-1) at efd.c:48
#2  0x00000001005c837d in nn_sock_recv () from /usr/local/lib/libnanomsg.0.dylib
dwarf2read.c:10350: internal-error: dwarf2_record_block_ranges: Assertion `dwarf2_per_objfile->ranges.readin' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

dwarf2read.c:10350: internal-error: dwarf2_record_block_ranges: Assertion `dwarf2_per_objfile->ranges.readin' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
#3  0x00000001005c68cc in nn_recv ()
   from /usr/local/lib/libnanomsg.0.dylib
dwarf2read.c:10350: internal-error: dwarf2_record_block_ranges: Assertion `dwarf2_per_objfile->ranges.readin' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

dwarf2read.c:10350: internal-error: dwarf2_record_block_ranges: Assertion `dwarf2_per_objfile->ranges.readin' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
(gdb) i th
  Id   Target Id         Frame 
  6    Thread 0x1d03 of process 21221 0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
  5    Thread 0x1c03 of process 21221 0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
* 4    Thread 0x1b03 of process 21221 0x00007fff84a41d62 in poll () from /usr/lib/libSystem.B.dylib
  3    Thread 0x1a03 of process 21221 0x00007fff849bed7a in mach_msg_trap ()
   from /usr/lib/libSystem.B.dylib
  2    Thread 0x1903 of process 21221 0x00007fff849bed7a in mach_msg_trap ()
   from /usr/lib/libSystem.B.dylib
  1    Thread 0x1703 of process 21221 0x00007fff849f9a6a in __semwait_signal ()
   from /usr/lib/libSystem.B.dylib
(gdb) thr 5
[Switching to thread 5 (Thread 0x1c03 of process 21221)]
#0  0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
#1  0x000000010061ce73 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#2  0x000000010060ed88 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#3  0x00000001000e01b7 in rt::sched::__extensions__::meth_31118::run::_f3525925b944a51::_0$x2e8$x2dpre
    ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#4  0x000000010009f679 in rt::sched::__extensions__::meth_23547::bootstrap::_0d3444f63df3e14::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#5  0x0000000100123334 in rt::run_::anon::expr_fn_36480 ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#6  0x0000000100602ada in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#7  0x00007fff849f7fd6 in _pthread_start () from /usr/lib/libSystem.B.dylib
#8  0x00007fff849f7e89 in thread_start () from /usr/lib/libSystem.B.dylib
#9  0x0000000000000000 in ?? ()
(gdb) thr 6
[Switching to thread 6 (Thread 0x1d03 of process 21221)]
#0  0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849d7c0a in kevent () from /usr/lib/libSystem.B.dylib
#1  0x00000001005ca7ec in nn_poller_wait (self=0x1005e85a0 <self+160>, timeout=0)
    at /usr/cn/nanomsg/src/aio/poller_kqueue.inc:172
#2  0x00000001005cd3a4 in nn_worker_routine () from /usr/local/lib/libnanomsg.0.dylib
#3  0x00000001005cf60d in nn_thread_main_routine () from /usr/local/lib/libnanomsg.0.dylib
#4  0x00007fff849f7fd6 in _pthread_start () from /usr/lib/libSystem.B.dylib
#5  0x00007fff849f7e89 in thread_start () from /usr/lib/libSystem.B.dylib
#6  0x0000000000000000 in ?? ()
(gdb) thr 1
[Switching to thread 1 (Thread 0x1703 of process 21221)]
#0  0x00007fff849f9a6a in __semwait_signal () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0  0x00007fff849f9a6a in __semwait_signal () from /usr/lib/libSystem.B.dylib
#1  0x00007fff84a20896 in pthread_join () from /usr/lib/libSystem.B.dylib
#2  0x0000000100602b50 in ?? ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
#3  0x000000010009e7a6 in rt::thread::__extensions__::meth_23418::join::_f3525925b944a51::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#4  0x0000000100120b8c in rt::run_::_82e8c355ab8d949f::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#5  0x00000001000d00eb in unstable::lang::start::_76d6c774aa357c7a::_0$x2e8$x2dpre ()
   from /Users/me/dev/rust-nanomsg/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
#6  0x000000010000db2b in main ()
(gdb) 

@alexcrichton
Copy link
Member

The runtime has change many times and has gone through many iterations since this issue was opened. We have an ever-growing suite of TCP tests in both green and native mode. Additionally, there have been a large number of runtime fixes since when this was opened.

Due to being unable to reproduce, closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 9, 2022
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 9, 2022
Fix `suboptimal_float` not linting on `{const}.powf({const})`

There used to be an early return if the receiver was an effective const but the method was not linted, not taking into account later cases where the receiver and the arguments are both effective consts for different methods. Removed the early return.

Fixes rust-lang#9402
Fixes rust-lang#9201

changelog: Fix `suboptimal_flops`, `imprecise_flops` not linting on `{const}.powf({const})` et al
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows O-macos Operating system: macOS
Projects
None yet
Development

No branches or pull requests

2 participants