Skip to content
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

Crash on macos (m1) #93

Open
gibberton opened this issue Jun 11, 2023 · 9 comments
Open

Crash on macos (m1) #93

gibberton opened this issue Jun 11, 2023 · 9 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@gibberton
Copy link

Describe the bug
Crash on startup.

To Reproduce
cargo run will crash.

Additional context
Trying to debugging this to no avail. This is kind of head-scratcher. Let me know if there's something you want me to try or code to write.

Older versions (for example git ref 5d9485885f0a6bb0e0a6c710e99e2937f3af0dcc) will run inside lldb, but cargo run and target/debug/buttplug-lite will always crash.

Currently, checkout from master and cargo run will crash and running it inside lldb will crash. I've been trying to figure it out on my own, but figured i submit a bug in case its something you had seen before.

Running in side lldb

(lldb) target create "target/debug/buttplug-lite"
Current executable set to '/Users/gibberton/source/rust/buttplug-lite/target/debug/buttplug-lite' (arm64).
(lldb) r -c -v
Process 38639 launched: '/Users/gibberton/source/rust/buttplug-lite/target/debug/buttplug-lite' (arm64)
2023-06-11T15:36:07.021174Z  INFO buttplug_lite: initializing buttplug-lite 2.4.1
2023-06-11T15:36:07.035749Z  INFO buttplug::server: Buttplug Server Operating System Info: Mac OS 13.4.0 [64-bit]
2023-06-11T15:36:07.035819Z  INFO buttplug::util::device_configuration: Loading from custom base device configuration...
2023-06-11T15:36:07.072459Z  INFO buttplug::util::device_configuration: No user configuration given.
2023-06-11T15:36:07.074377Z  INFO buttplug::server::device::server_device_manager: BtlePlugCommunicationManager: false
2023-06-11T15:36:07.074388Z  INFO buttplug::server::device::server_device_manager: SerialPortCommunicationManager: true
2023-06-11T15:36:07.074394Z  INFO buttplug::server::device::server_device_manager: LovenseHIDDongleCommunicationManager: false
2023-06-11T15:36:07.074399Z  INFO buttplug::server::device::server_device_manager: LovenseSerialDongleCommunicationManager: false
2023-06-11T15:36:07.074404Z  INFO buttplug::server::device::server_device_manager: LovenseServiceDeviceCommManager: true
2023-06-11T15:36:07.074440Z  INFO Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T15:36:07.074483Z  INFO Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T15:36:07.074485Z  INFO buttplug::client: Connecting to server.
2023-06-11T15:36:07.074526Z  INFO buttplug::client: Connection to server succeeded.
2023-06-11T15:36:07.074562Z  INFO buttplug::client: Running handshake with server.
2023-06-11T15:36:07.074586Z  INFO InProcessClientConnectorEventSenderLoop: buttplug::core::connector::in_process_connector: Starting In Process Client Connector Event Sender Loop
2023-06-11T15:36:07.074637Z  INFO Client Loop Span: buttplug::server: Performing server handshake check with client in-process-client at message version Version3.
2023-06-11T15:36:07.074720Z  INFO buttplug::client: Connected to buttplug-lite
2023-06-11T15:36:07.074794Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: Device server started!
2023-06-11T15:36:07.074847Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: starting device scan
2023-06-11T15:36:07.074961Z  INFO buttplug_lite::config::util: Attempting to load config from "/Users/gibberton/Library/Application Support/io.github.runtime-shady-backroom.buttplug-lite/config.toml"
2023-06-11T15:36:07.074993Z  WARN buttplug_lite::config::util: falling back to default config due to error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
2023-06-11T15:36:07.075003Z  INFO buttplug_lite::config::util: Loaded configuration v3 from disk
2023-06-11T15:36:07.075158Z  INFO buttplug_lite::app::webserver::routes: starting web server on 127.0.0.1:3031
2023-06-11T15:36:07.075216Z  WARN Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Cannot find Lovense Serial dongle.
2023-06-11T15:36:07.087032Z  WARN Lovense HID Dongle Finder Task: buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Cannot find lovense HID dongle.
2023-06-11T15:36:07.509142Z ERROR buttplug_lite::util::panic: buttplug-lite v2.4.1 has crashed.
To help me diagnose this problem you can attach this log file to a new GitHub issue at https://github.com/runtime-shady-backroom/buttplug-lite/issues
thread 'main' panicked at 'ASDF', /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
Process 38639 exited with status = 101 (0x00000065)
@gibberton gibberton added the bug Something isn't working label Jun 11, 2023
@runtime-shady-backroom
Copy link
Owner

In the current master branch (5edffbe), try running a debug build from a terminal with -vvv --stdout arguments... you might get some more verbose logs.

If I'm reading your log properly, it looks like fuse in futures-util is panicking for some reason. I'm not sure why, unless perhaps there's an M1-specific bug in futures-util itself.

@runtime-shady-backroom
Copy link
Owner

Hmm, after staring at the select_next_some documentation, I'm thinking that perhaps I was polling a future in an unsafe way. In 7b4a81a I've changed how I read that future to be in line with the docs, which might clear this whole thing up.

By the way, thanks for the bug report! I'm happy to hear that you're getting some use out of this software. You know, you might be the first person ever to run this on an M1 processor?

@gibberton
Copy link
Author

Ok just tried it out, still have a crash, but i do have more logging. I looked at the line of code that the backtrace reported, but i didn't have any added wisdom to fix.

(lldb) r -c -vvv
Process 39212 launched: '/Users/gibberton/source/rust/buttplug-lite/target/debug/buttplug-lite' (arm64)
2023-06-11T23:07:46.474886Z  INFO buttplug_lite: initializing buttplug-lite 2.5.0
2023-06-11T23:07:46.475201Z DEBUG buttplug::server: Creating server 'buttplug-lite'
2023-06-11T23:07:46.488601Z  INFO buttplug::server: Buttplug Server Operating System Info: Mac OS 13.4.0 [64-bit]
2023-06-11T23:07:46.490198Z  INFO buttplug::util::device_configuration: Loading from custom base device configuration...
2023-06-11T23:07:46.528697Z  INFO buttplug::util::device_configuration: No user configuration given.
2023-06-11T23:07:46.531459Z  INFO buttplug::server::device::server_device_manager: BtlePlugCommunicationManager: false
2023-06-11T23:07:46.531471Z  INFO buttplug::server::device::server_device_manager: SerialPortCommunicationManager: true
2023-06-11T23:07:46.531476Z  INFO buttplug::server::device::server_device_manager: LovenseHIDDongleCommunicationManager: false
2023-06-11T23:07:46.531480Z  INFO buttplug::server::device::server_device_manager: LovenseSerialDongleCommunicationManager: false
2023-06-11T23:07:46.531485Z  INFO buttplug::server::device::server_device_manager: LovenseServiceDeviceCommManager: true
2023-06-11T23:07:46.531530Z  INFO Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:07:46.531570Z  INFO Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:07:46.531750Z  INFO buttplug::client: Connecting to server.
2023-06-11T23:07:46.531787Z  INFO buttplug::client: Connection to server succeeded.
2023-06-11T23:07:46.531814Z  INFO buttplug::client: Running handshake with server.
2023-06-11T23:07:46.531805Z DEBUG buttplug::server::device::server_device_manager_event_loop: Starting Device Manager Loop
2023-06-11T23:07:46.531844Z DEBUG Client Loop Span: buttplug::client::client_event_loop: Running client event loop.
2023-06-11T23:07:46.531856Z  INFO InProcessClientConnectorEventSenderLoop: buttplug::core::connector::in_process_connector: Starting In Process Client Connector Event Sender Loop
2023-06-11T23:07:46.531909Z  INFO Client Loop Span: buttplug::server: Performing server handshake check with client in-process-client at message version Version3.
2023-06-11T23:07:46.531942Z DEBUG Client Loop Span:Buttplug Server Message{id=1}: buttplug::server: Server handshake check successful.
2023-06-11T23:07:46.532001Z DEBUG buttplug::client: Got ServerInfo return.
2023-06-11T23:07:46.532009Z  INFO buttplug::client: Connected to buttplug-lite
2023-06-11T23:07:46.532077Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: Device server started!
2023-06-11T23:07:46.532119Z DEBUG Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Got 2 serial ports back
2023-06-11T23:07:46.532140Z  WARN Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Cannot find Lovense Serial dongle.
2023-06-11T23:07:46.532152Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: starting device scan
2023-06-11T23:07:46.532171Z  INFO buttplug::server::device::server_device_manager_event_loop: No scan currently in progress, starting new scan.
2023-06-11T23:07:46.532187Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Lovense Dongle Manager scanning for devices
2023-06-11T23:07:46.532193Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Lovense Dongle Manager scanning for devices.
2023-06-11T23:07:46.532225Z DEBUG buttplug::server::device::server_device_manager_event_loop: Scanning started for all hardware comm managers.
2023-06-11T23:07:46.532237Z DEBUG Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:07:46.532250Z DEBUG Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:07:46.532259Z  INFO buttplug_lite::config::util: Attempting to load config from "/Users/gibberton/Library/Application Support/io.github.runtime-shady-backroom.buttplug-lite/config.toml"
2023-06-11T23:07:46.532288Z  WARN buttplug_lite::config::util: falling back to default config due to error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
2023-06-11T23:07:46.532301Z  INFO buttplug_lite::config::util: Loaded configuration v3 from disk
2023-06-11T23:07:46.532457Z  INFO buttplug_lite::app::webserver::routes: starting web server on 127.0.0.1:3031
2023-06-11T23:07:46.532519Z DEBUG reqwest::connect: starting new connection: https://api.lovense.com/
thread 'main' panicked at 'ASDF', /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
stack backtrace:
2023-06-11T23:07:46.536745Z DEBUG btleplug::corebluetooth::adapter: Waiting on adapter connect
2023-06-11T23:07:46.536752Z DEBUG buttplug::server::device::hardware::communication::serialport::serialport_comm_manager: Got 2 serial ports back
2023-06-11T23:07:46.536813Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/cu.Bluetooth-Incoming-Port (/dev/cu.Bluetooth-Incoming-Port) found.
2023-06-11T23:07:46.536817Z DEBUG hyper::client::connect::dns: resolving host="api.lovense.com"
2023-06-11T23:07:46.536825Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/cu.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:07:46.536850Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" })
2023-06-11T23:07:46.536869Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" }), ignoring.
2023-06-11T23:07:46.536879Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/tty.Bluetooth-Incoming-Port (/dev/tty.Bluetooth-Incoming-Port) found.
2023-06-11T23:07:46.536886Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/tty.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:07:46.536903Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" })
2023-06-11T23:07:46.536919Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" }), ignoring.
thread '<unnamed>' panicked at 'ASDF', /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
2023-06-11T23:07:46.538536Z DEBUG hyper::client::connect::http: connecting to 104.19.138.76:443
2023-06-11T23:07:46.543313Z  WARN Lovense HID Dongle Finder Task: buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Cannot find lovense HID dongle.
   0: std::panicking::begin_panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:611:12
   1: futures_util::stream::stream::StreamExt::fuse
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
   2: buttplug_lite::gui::subscription::SubscriptionProvider<T>::new
             at ./src/gui/subscription.rs:48:22
   3: buttplug_lite::tokio_main::{{closure}}
             at ./src/main.rs:97:28
   4: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:63
   5: tokio::runtime::coop::with_budget
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:107:5
   6: tokio::runtime::coop::budget
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:73:5
   7: tokio::runtime::park::CachedParkThread::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:31
   8: tokio::runtime::context::BlockingRegionGuard::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/context.rs:315:13
   9: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/scheduler/multi_thread/mod.rs:66:9
  10: tokio::runtime::runtime::Runtime::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/runtime.rs:304:45
  11: buttplug_lite::main
             at ./src/main.rs:33:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:611:12
thread 'tokio-runtime-worker' panicked at 'warp shut down started, but could not transmit callback signal: ()', src/app/webserver/routes.rsProcess 39212 exited with status = 101 (0x00000065)

@gibberton
Copy link
Author

Ooops, i forgot to add the --stdout switch. Here's another log.

(lldb) target create "target/debug/buttplug-lite"
Current executable set to '/Users/gibberton/source/rust/buttplug-lite/target/debug/buttplug-lite' (arm64).
(lldb) r -vvv --stdout
Process 41516 launched: '/Users/gibberton/source/rust/buttplug-lite/target/debug/buttplug-lite' (arm64)
2023-06-11T23:12:54.357574Z  INFO buttplug_lite: initializing buttplug-lite 2.5.0
2023-06-11T23:12:54.357888Z DEBUG buttplug::server: Creating server 'buttplug-lite'
2023-06-11T23:12:54.370686Z  INFO buttplug::server: Buttplug Server Operating System Info: Mac OS 13.4.0 [64-bit]
2023-06-11T23:12:54.372354Z  INFO buttplug::util::device_configuration: Loading from custom base device configuration...
2023-06-11T23:12:54.409165Z  INFO buttplug::util::device_configuration: No user configuration given.
2023-06-11T23:12:54.411854Z  INFO buttplug::server::device::server_device_manager: BtlePlugCommunicationManager: false
2023-06-11T23:12:54.411867Z  INFO buttplug::server::device::server_device_manager: SerialPortCommunicationManager: true
2023-06-11T23:12:54.411872Z  INFO buttplug::server::device::server_device_manager: LovenseHIDDongleCommunicationManager: false
2023-06-11T23:12:54.411876Z  INFO buttplug::server::device::server_device_manager: LovenseSerialDongleCommunicationManager: false
2023-06-11T23:12:54.411881Z  INFO buttplug::server::device::server_device_manager: LovenseServiceDeviceCommManager: true
2023-06-11T23:12:54.411918Z  INFO Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:12:54.412027Z  INFO Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:12:54.412143Z  INFO buttplug::client: Connecting to server.
2023-06-11T23:12:54.412176Z  INFO buttplug::client: Connection to server succeeded.
2023-06-11T23:12:54.412217Z DEBUG buttplug::server::device::server_device_manager_event_loop: Starting Device Manager Loop
2023-06-11T23:12:54.412268Z  INFO buttplug::client: Running handshake with server.
2023-06-11T23:12:54.412271Z  INFO InProcessClientConnectorEventSenderLoop: buttplug::core::connector::in_process_connector: Starting In Process Client Connector Event Sender Loop
2023-06-11T23:12:54.412307Z DEBUG Client Loop Span: buttplug::client::client_event_loop: Running client event loop.
2023-06-11T23:12:54.412370Z  INFO Client Loop Span: buttplug::server: Performing server handshake check with client in-process-client at message version Version3.
2023-06-11T23:12:54.412413Z DEBUG Client Loop Span:Buttplug Server Message{id=1}: buttplug::server: Server handshake check successful.
2023-06-11T23:12:54.412482Z DEBUG buttplug::client: Got ServerInfo return.
2023-06-11T23:12:54.412491Z  INFO buttplug::client: Connected to buttplug-lite
2023-06-11T23:12:54.412504Z DEBUG Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Got 2 serial ports back
2023-06-11T23:12:54.412521Z  WARN Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Cannot find Lovense Serial dongle.
2023-06-11T23:12:54.412562Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: Device server started!
2023-06-11T23:12:54.412654Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: starting device scan
2023-06-11T23:12:54.412685Z  INFO buttplug::server::device::server_device_manager_event_loop: No scan currently in progress, starting new scan.
2023-06-11T23:12:54.412702Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Lovense Dongle Manager scanning for devices
2023-06-11T23:12:54.412708Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Lovense Dongle Manager scanning for devices.
2023-06-11T23:12:54.412725Z  INFO buttplug_lite::config::util: Attempting to load config from "/Users/gibberton/Library/Application Support/io.github.runtime-shady-backroom.buttplug-lite/config.toml"
2023-06-11T23:12:54.412742Z DEBUG buttplug::server::device::server_device_manager_event_loop: Scanning started for all hardware comm managers.
2023-06-11T23:12:54.412761Z DEBUG Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:12:54.412782Z DEBUG Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:12:54.412746Z  WARN buttplug_lite::config::util: falling back to default config due to error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
2023-06-11T23:12:54.412803Z  INFO buttplug_lite::config::util: Loaded configuration v3 from disk
2023-06-11T23:12:54.412961Z  INFO buttplug_lite::app::webserver::routes: starting web server on 127.0.0.1:3031
2023-06-11T23:12:54.413019Z DEBUG reqwest::connect: starting new connection: https://api.lovense.com/
main' panicked at 'ASDF', /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
stack backtrace:
2023-06-11T23:12:54.418770Z DEBUG buttplug::server::device::hardware::communication::serialport::serialport_comm_manager: Got 2 serial ports back
2023-06-11T23:12:54.418831Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/cu.Bluetooth-Incoming-Port (/dev/cu.Bluetooth-Incoming-Port) found.
2023-06-11T23:12:54.418842Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/cu.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:12:54.418842Z DEBUG btleplug::corebluetooth::adapter: Waiting on adapter connect
2023-06-11T23:12:54.418866Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" })
2023-06-11T23:12:54.418910Z DEBUG hyper::client::connect::dns: resolving host="api.lovense.com"
2023-06-11T23:12:54.418914Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" }), ignoring.
2023-06-11T23:12:54.418941Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/tty.Bluetooth-Incoming-Port (/dev/tty.Bluetooth-Incoming-Port) found.
2023-06-11T23:12:54.418949Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/tty.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:12:54.418974Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" })
2023-06-11T23:12:54.418993Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" }), ignoring.
thread '<unnamed>' panicked at 'ASDF', /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
2023-06-11T23:12:54.420758Z DEBUG hyper::client::connect::http: connecting to 104.19.138.76:443
2023-06-11T23:12:54.424961Z  WARN Lovense HID Dongle Finder Task: buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Cannot find lovense HID dongle.
   0: std::panicking::begin_panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:611:12
   1: futures_util::stream::stream::StreamExt::fuse
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9
   2: buttplug_lite::gui::subscription::SubscriptionProvider<T>::new
             at ./src/gui/subscription.rs:48:22
   3: buttplug_lite::tokio_main::{{closure}}
             at ./src/main.rs:97:28
   4: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:63
   5: tokio::runtime::coop::with_budget
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:107:5
   6: tokio::runtime::coop::budget
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/coop.rs:73:5
   7: tokio::runtime::park::CachedParkThread::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/park.rs:283:31
   8: tokio::runtime::context::BlockingRegionGuard::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/context.rs:315:13
   9: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/scheduler/multi_thread/mod.rs:66:9
  10: tokio::runtime::runtime::Runtime::block_on
             at /Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.2/src/runtime/runtime.rs:304:45
  11: buttplug_lite::main
             at ./src/main.rs:33:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:611:12
thread 'tokio-runtime-worker' panicked at 'warp shut down started, but could not transmit callback signal: ()', src/app/webserver/routes.rs:129:44
Process 41516 exited with status = 101 (0x00000065)
gibberton

@gibberton
Copy link
Author

Ok .... i got it to run, but only in the debugger, but hey, that's progress. I looked at the function in the log above
/Users/gibberton/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.28/src/stream/stream/mod.rs:1243:9 and it had a panic!() call in the function. After cleaning out my ~/.cargo/registry, that panic!() call was gone -- perhaps i added it when i was testing/debugging something else??? i don't remember.

eitherway, it runs under the debugger, but still crashes running it normally. here's the log when running it normally.

    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/debug/buttplug-lite -vvv --stdout`
2023-06-11T23:29:19.805184Z  INFO buttplug_lite: initializing buttplug-lite 2.5.0
2023-06-11T23:29:19.808305Z DEBUG buttplug::server: Creating server 'buttplug-lite'
2023-06-11T23:29:19.820503Z  INFO buttplug::server: Buttplug Server Operating System Info: Mac OS 13.4.0 [64-bit]
2023-06-11T23:29:19.820596Z  INFO buttplug::util::device_configuration: Loading from custom base device configuration...
2023-06-11T23:29:19.866011Z  INFO buttplug::util::device_configuration: No user configuration given.
2023-06-11T23:29:19.869326Z  INFO Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:29:19.869426Z  INFO buttplug::server::device::server_device_manager: BtlePlugCommunicationManager: false
2023-06-11T23:29:19.869527Z  INFO buttplug::server::device::server_device_manager: SerialPortCommunicationManager: true
2023-06-11T23:29:19.869553Z  INFO buttplug::server::device::server_device_manager: LovenseHIDDongleCommunicationManager: false
2023-06-11T23:29:19.869558Z  INFO buttplug::server::device::server_device_manager: LovenseSerialDongleCommunicationManager: false
2023-06-11T23:29:19.869577Z  INFO buttplug::server::device::server_device_manager: LovenseServiceDeviceCommManager: true
2023-06-11T23:29:19.869767Z  INFO Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Running wait for dongle step
2023-06-11T23:29:19.869935Z DEBUG Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Got 2 serial ports back
2023-06-11T23:29:19.869956Z  WARN Lovense Serial Dongle Finder: buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Cannot find Lovense Serial dongle.
2023-06-11T23:29:19.870107Z  INFO buttplug::client: Connecting to server.
2023-06-11T23:29:19.870198Z  INFO buttplug::client: Connection to server succeeded.
2023-06-11T23:29:19.870234Z DEBUG buttplug::server::device::server_device_manager_event_loop: Starting Device Manager Loop
2023-06-11T23:29:19.870260Z  INFO buttplug::client: Running handshake with server.
2023-06-11T23:29:19.870336Z  INFO InProcessClientConnectorEventSenderLoop: buttplug::core::connector::in_process_connector: Starting In Process Client Connector Event Sender Loop
2023-06-11T23:29:19.870410Z DEBUG Client Loop Span: buttplug::client::client_event_loop: Running client event loop.
2023-06-11T23:29:19.870601Z  INFO Client Loop Span: buttplug::server: Performing server handshake check with client in-process-client at message version Version3.
2023-06-11T23:29:19.870642Z DEBUG Client Loop Span:Buttplug Server Message{id=1}: buttplug::server: Server handshake check successful.
2023-06-11T23:29:19.870712Z DEBUG buttplug::client: Got ServerInfo return.
2023-06-11T23:29:19.870720Z  INFO buttplug::client: Connected to buttplug-lite
2023-06-11T23:29:19.870807Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: Device server started!
2023-06-11T23:29:19.870866Z  INFO buttplug_lite::app::buttplug::startup: buttplug_server: starting device scan
2023-06-11T23:29:19.870882Z  INFO buttplug::server::device::server_device_manager_event_loop: No scan currently in progress, starting new scan.
2023-06-11T23:29:19.870897Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Lovense Dongle Manager scanning for devices
2023-06-11T23:29:19.870904Z DEBUG buttplug::server::device::hardware::communication::lovense_dongle::lovense_serial_dongle_comm_manager: Lovense Dongle Manager scanning for devices.
2023-06-11T23:29:19.870944Z DEBUG buttplug::server::device::server_device_manager_event_loop: Scanning started for all hardware comm managers.
2023-06-11T23:29:19.870962Z DEBUG Lovense HID Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:29:19.870996Z DEBUG Lovense Serial Dongle State Machine: buttplug::server::device::hardware::communication::lovense_dongle::lovense_dongle_state_machine: Lovense dongle not found, storing StartScanning command until found.
2023-06-11T23:29:19.871022Z  INFO buttplug_lite::config::util: Attempting to load config from "/Users/gibberton/Library/Application Support/io.github.runtime-shady-backroom.buttplug-lite/config.toml"
2023-06-11T23:29:19.871299Z DEBUG buttplug::server::device::hardware::communication::serialport::serialport_comm_manager: Got 2 serial ports back
2023-06-11T23:29:19.872146Z DEBUG reqwest::connect: starting new connection: https://api.lovense.com/
2023-06-11T23:29:19.877906Z  WARN Lovense HID Dongle Finder Task: buttplug::server::device::hardware::communication::lovense_dongle::lovense_hid_dongle_comm_manager: Cannot find lovense HID dongle.
2023-06-11T23:29:19.884781Z  WARN buttplug_lite::config::util: falling back to default config due to error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
2023-06-11T23:29:19.884802Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/cu.Bluetooth-Incoming-Port (/dev/cu.Bluetooth-Incoming-Port) found.
2023-06-11T23:29:19.884813Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/cu.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:29:19.884820Z  INFO buttplug_lite::config::util: Loaded configuration v3 from disk
2023-06-11T23:29:19.884853Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" })
2023-06-11T23:29:19.884874Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/cu.Bluetooth-Incoming-Port" }), ignoring.
2023-06-11T23:29:19.884887Z  INFO buttplug::server::device::server_device_manager_event_loop: Device Serial Port Device /dev/tty.Bluetooth-Incoming-Port (/dev/tty.Bluetooth-Incoming-Port) found.
2023-06-11T23:29:19.884893Z DEBUG buttplug::server::device::server_device_manager_event_loop: Device /dev/tty.Bluetooth-Incoming-Port allowed via configuration file, continuing.
2023-06-11T23:29:19.884909Z DEBUG buttplug::server::device::configuration: Looking for protocol that matches specifier: Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" })
2023-06-11T23:29:19.884921Z DEBUG buttplug::server::device::server_device_manager_event_loop: No viable protocols for hardware Serial(SerialSpecifier { baud_rate: 0, data_bits: 0, stop_bits: 0, parity: '\0', port: "/dev/tty.Bluetooth-Incoming-Port" }), ignoring.
2023-06-11T23:29:19.885005Z DEBUG hyper::client::connect::dns: resolving host="api.lovense.com"
2023-06-11T23:29:19.885095Z  INFO buttplug_lite::app::webserver::routes: starting web server on 127.0.0.1:3031
2023-06-11T23:29:19.888455Z DEBUG hyper::client::connect::http: connecting to 104.19.138.76:443
2023-06-11T23:29:19.895073Z DEBUG btleplug::corebluetooth::adapter: Waiting on adapter connect
[1]    46566 abort      RUST_BACKTRACE=1 cargo run -- -vvv --stdout

@runtime-shady-backroom
Copy link
Owner

I looked at the function in the log above ... and it had a panic!() call in the function.

For me, futures_util::stream::StreamExt::fuse in futures-util 0.3.28 looks like this:

fn fuse(self) -> Fuse<Self>
where
    Self: Sized,
{
    assert_stream::<Self::Item, _>(Fuse::new(self))
}

assert_stream is a no-op (looks like a compile-time type check to me). Fuse::new just creates a struct and doesn't actually run any code. I took a look around and I'm not seeing any #[cfg] stuff in futures-util that looks it would cause platform dependent implementations for fuse. Not sure how this can panic, unless I'm overlooking something.

it runs under the debugger, but still crashes running it normally

I'm not sure why you're getting no backtrace with your cargo run -- -vvv --stdout invocation. I'd suspected my custom panic handler might be getting in the way, but with the --stdout flag set my custom panic handler ought to be disabled.

@gibberton
Copy link
Author

I just did some looking around. I believe that this might be a bug in buttplug. This change by-passes warp and iced and still crashes.

  buttplug::start_server(application_state_db.clone(), initial_config_loaded_tx, application_status_sender).await;
+  std::thread::sleep(std::time::Duration::from_secs(3)); // added sleep
+  std::process::exit(0);   // never executes this line, crashes before. 

Do you know if anyone else has run this on a Mac? I wonder if its an issue related to their permission system.

@runtime-shady-backroom
Copy link
Owner

This change by-passes warp and iced and still crashes.

Well dang, if it's crashing without warp or iced, that rules most things out. What's left? Buttplug itself obviously, and I guess Tokio? I wonder if this is the Tokio runtime getting into some weird bad state and causing crashes at unexpected times in unexpected places. I've got zero ideas, and I don't have any M1 hardware I can try to reproduce on.

Do you know if anyone else has run this on a Mac? I wonder if its an issue related to their permission system.

No idea. I have zero telemetry and for some reason people tend to be a bit private about their use of this software. But given that this is mostly used by Neos folks and Neos has essentially zero Mac support, I'd be very surprised if you aren't the first Mac user, M1 or otherwise.

@gibberton
Copy link
Author

Well dang, if it's crashing without warp or iced, that rules most things out. What's left? Buttplug itself obviously, and I guess Tokio? I wonder if this is the Tokio runtime getting into some weird bad state and causing crashes at unexpected times in unexpected places. I've got zero ideas, and I don't have any M1 hardware I can try to reproduce on.

Yeah, i'll dig in a little more.

@runtime-shady-backroom runtime-shady-backroom added the help wanted Extra attention is needed label Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants