Skip to content

program works most of the time but sometimes run into a dead state consuming 100% CPU usage #709

@zTrix

Description

@zTrix

Async-std is really an awesome library for writing async programs.

I've written a small socks5 server using async-std, and it works most of the time.

But sometimes, the server suddenly enter into a weird state, without responding to anything.

Use top I can see that the process is consuming 100% CPU, something like dead loop/lock.

Attach gdb to the process and call stack is as below.

[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007fda95b789f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5562f9b5bdd8) at ../sysdeps/unix/sysv/linux/futex-internal.h:88 88 ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory. (gdb) bt #0 0x00007fda95b789f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5562f9b5bdd8) at ../sysdeps/unix/sysv/linux/futex-internal.h:88 #1 __pthread_cond_wait_common (abstime=0x0, mutex=0x5562f9b5bd80, cond=0x5562f9b5bdb0) at pthread_cond_wait.c:502 #2 __pthread_cond_wait (cond=0x5562f9b5bdb0, mutex=0x5562f9b5bd80) at pthread_cond_wait.c:655 #3 0x00005562f85c5b4d in crossbeam_utils::sync::parker::Inner::park () #4 0x00005562f85c57fb in crossbeam_utils::sync::parker::Parker::park () #5 0x00005562f840f561 in std::thread::local::LocalKey<T>::with () #6 0x00005562f840f3ed in std::thread::local::LocalKey<T>::with () #7 0x00005562f843e8e5 in async_std::task::block_on::block_on () #8 0x00005562f8417df2 in mysocks::main () #9 0x00005562f8415fd0 in std::rt::lang_start::{{closure}} () #10 0x00005562f85d4653 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:52 #11 std::panicking::try::do_call () at src/libstd/panicking.rs:292 #12 0x00005562f85d869a in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:78 #13 0x00005562f85d50a0 in std::panicking::try () at src/libstd/panicking.rs:270 #14 std::panic::catch_unwind () at src/libstd/panic.rs:394 #15 std::rt::lang_start_internal () at src/libstd/rt.rs:51 #16 0x00005562f8417ef2 in main () 

Any hint on the root cause of this issue? And how could I debug into this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions