betrusted-io / xous-core

The Xous microkernel
Apache License 2.0
533 stars 85 forks source link

Intermittent panic in thread local storage implementation #323

Open bunnie opened 1 year ago

bunnie commented 1 year ago

A panic was observed in the net server on a CI run today:

PANIC in PID 11:
<unnamed>' panicked at 'can't destroy keys on Xous', library/std/src/sys/xous/thread_local_key.rs:98:5

Apparently this is linked to a rarely triggered condition in the newly refactored thread local storage (TLS) implementation.

This bug has been opened to track any further occurrences of this panic in an attempt to create a reliable test case to chase it down.

Based on the context of this panic, it happened in the net server sometime during the DHCP negotiation. This fits with some issue in thread local storage since the net server is heavily multi-threaded internally.

xobs commented 1 year ago

With https://github.com/betrusted-io/rust/commit/c9a00020835b613ad4eff578662282b80b30b7a2 we now have the ability to destroy keys on Xous. This code comes from a libstd rework, and has been backported to the patchset that we've been carrying since Rust 1.50