cloudflare / cloudflare/boringtun

Write lock never released

Open
#313 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
7.2k
Forks
532
PR merge metrics
No merged PRs in 30d

Description

I was experimenting to understand the code base better and discovered that a device handle write lock is never released if [mut_func](https://github.com/cloudflare/boringtun/blob/master/boringtun/src/device/dev_lock.rs#L89) `panic!`s. As a result, the `DeviceHandle`'s remaining `event_loop` threads are blocked from doing any other work.

Generally it's not an issue unless someone is working on [api::api_set()](https://github.com/cloudflare/boringtun/blob/master/boringtun/src/device/api.rs). On MacOS, I see my application "freeze" and I have to `sudo kill` (not sure why but `ctrl-c` doesn't work once the condition is hit) the process which results in the `utun` interface hanging around until I reboot.

Contributor guide

Open the contributing guide

Research direction

Start in boringtun/src/device/dev_lock.rs at mut_func and trace the write-lock handling when the callback panics; then inspect boringtun/src/device/api.rs around api::api_set(). Reproduce the panic path if possible and verify that the remaining event_loop threads can continue working and the device handle does not remain blocked.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.