Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Last active December 20, 2015 14:09
Show Gist options
  • Save olsonjeffery/6144194 to your computer and use it in GitHub Desktop.
Save olsonjeffery/6144194 to your computer and use it in GitHub Desktop.
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe4cc3700 (LWP 7875)]
0x00007ffff617e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff617e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6181b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff705d15c in upcall_call_shim_on_c_stack (args=0x7fffe4cc2008, fn_ptr=0x698010 <abort__c_stack_shim>) at /home/jeff/src/rust/src/rt/rust_upcall.cpp:78
#3 0x000000000055f581 in libc::funcs::c95::stdlib::abort::_3951cf1a412d1f90::_0$x2e8$x2dpre ()
#4 0x00000000005086c0 in rt::util::abort::_0cb6664c2aeff9f::_0$x2e8$x2dpre ()
#5 0x000000000078300c in rt::aio::net::tcp::__extensions__::connect::anon::expr_fn_62736 ()
#6 0x000000000078f2ae in rt::uv::uvio::__extensions__::tcp_connect_async::anon::expr_fn_63758 ()
#7 0x00000000007b709b in rt::uv::net::__extensions__::close_cb::__rust_stack_shim ()
#8 0x00007ffff705d42c in upcall_call_shim_on_rust_stack (args=0x7fffe4cc2c08, fn_ptr=0x7b7020 <_ZN2rt2uv3net14__extensions__8close_cb17__rust_stack_shimE78>)
at /home/jeff/src/rust/src/rt/rust_upcall.cpp:103
#9 0x00000000007b7019 in rt::uv::net::__extensions__::close_cb::_af556f5452819380::_0$x2e8$x2dpre ()
#10 0x00007ffff706d486 in uv_run () from /home/jeff/src/rust/build/x86_64-unknown-linux-gnu/stage1/test/../lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so
#11 0x00007ffff705d15c in upcall_call_shim_on_c_stack (args=0x7fffe4cc2d40, fn_ptr=0x7b1f70 <rust_uv_run__c_stack_shim>) at /home/jeff/src/rust/src/rt/rust_upcall.cpp:78
#12 0x000000000074785d in rt::sched::__extensions__::meth_59093::bootstrap::_7db98343d1d58d86::_0$x2e8$x2dpre ()
#13 0x0000000000753eda in rt::test::run_in_newsched_task_core::_9277a1ca79645b::_0$x2e8$x2dpre ()
#14 0x00000000007c77ad in rt::test::run_in_newsched_task::anon::expr_fn_66606 ()
#15 0x00007ffff705562a in rust_thread_start (ptr=<optimized out>) at /home/jeff/src/rust/src/rt/sync/rust_thread.cpp:36
#16 0x00007ffff6c24e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#17 0x00007ffff623bccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#18 0x0000000000000000 in ?? ()
(gdb)
87 fn connect_error_async_impl() {
88 do run_in_newsched_task {
89 let mut called = false;
90 do io_error::cond.trap(|e| {
91 assert!(e.kind == ConnectionRefused || e.kind == PermissionDenied);
92 called = true;
93 }).inside {
94 let addr = Ipv4(0, 0, 0, 0, 1);
95 let stream = TcpStreamAsync::connect(addr).unwrap();
96 assert!(stream.is_none());
97 }
98 assert!(called);
99 }
100 }
// on TcpStreamAsync
33 pub fn connect(addr: IpAddr) -> Future<Option<TcpStreamAsync>> {
34 unsafe {
35 let (ret_future, ret_promise) = pair();
36 rtdebug!("borrowing io to connect");
37 let io = Local::unsafe_borrow::<IoFactoryObject>();
38 rtdebug!("about to connect");
39 let p_cell = Cell::new(ret_promise);
40 (*io).tcp_connect_async(addr,
41 |connect_result| {
42 let ret_promise = p_cell.take();
43 ret_promise.fulfill(connect_result);
44 }
45 );
46 let f_cell = Cell::new(ret_future);
47 future::from_fn(|| {
48 let ret_future = f_cell.take();
49 let r = ret_future.unwrap();
50 match r {
51 Ok(s) => Some(TcpStreamAsync::new(s)),
52 Err(e) => {
53 rtdebug!("failed to async connect: %?", e);
54 io_error::cond.raise(e);
55 None
56 }
57 }
58 })
59 }
60 }
87 fn connect_error_async_impl() {
88 do run_in_newsched_task {
89 let mut called = false;
90 do io_error::cond.trap(|e| {
91 assert!(e.kind == ConnectionRefused || e.kind == PermissionDenied);
92 called = true;
93 }).inside {
94 let addr = Ipv4(0, 0, 0, 0, 1);
95 let stream = TcpStreamAsync::connect(addr).unwrap();
96 assert!(stream.is_none());
97 }
98 assert!(called);
99 }
100 }
// this is in UvIoFactory...
306 fn tcp_connect_async(&mut self, addr: IpAddr,
307 cb: ~fn(Result<~RtaioTcpStreamAsync, IoError>)) {
308 let mut watcher = TcpWatcher::new(self.uv_loop());
309 match watcher.bind(addr) {
310 Ok(_) => {
311 let r = Ok(~UvTcpStreamAsync(watcher) as ~RtaioTcpStreamAsync);
312 cb(r);
313 },
314 Err(uverr) => {
315 let cb_cell = Cell::new(cb);
316 do watcher.as_stream().close {
317 let cb = cb_cell.take();
318 cb(Err(uv_error_to_io_error(uverr)))
319 }
320 }
321 }
322 }
245 fn tcp_connect_common(&mut self, addr: IpAddr,
246 cleanup_cb: ~fn(Result<TcpWatcher, UvError>)) {
247 let mut tcp_watcher = TcpWatcher::new(self.uv_loop());
248 let cleanup_cb_cell = Cell::new(cleanup_cb);
249
250 // Wait for a connection
251 do tcp_watcher.connect(addr) |stream_watcher, status| {
252 rtdebug!("connect: in connect callback");
253 let cleanup_cb = cleanup_cb_cell.take();
254 if status.is_none() {
255 rtdebug!("status is none");
256 let tcp_watcher =
257 NativeHandle::from_native_handle(stream_watcher.native_handle());
258 let res = Ok(tcp_watcher);
259 cleanup_cb(res);
260 } else {
261 rtdebug!("status is some");
262 do stream_watcher.close {
263 let res = Err(status.get());
264 cleanup_cb(res);
265 }
266 };
267 }
268 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment