ble-peripheral-rust icon indicating copy to clipboard operation
ble-peripheral-rust copied to clipboard

Crashed on windows 11.

Open smallzhan opened this issue 9 months ago • 1 comments

While it runs smoothly on Macos. See backtrace...

any suggestions?

 2025-03-21T12:21:29.300Z INFO  rsperipheral::startup > CharacteristicSubscriptionUpdate: Subscribed true PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 00001826-0000-1000-8000-00805f9b34fb, characteristic: 00002ad9-0000-1000-8000-00805f9b34fb }
 2025-03-21T12:21:29.327Z INFO  rsperipheral::startup > CharacteristicSubscriptionUpdate: Subscribed true PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 00001826-0000-1000-8000-00805f9b34fb, characteristic: 00002acd-0000-1000-8000-00805f9b34fb }
 2025-03-21T12:21:29.394Z INFO  rsperipheral::startup > CharacteristicSubscriptionUpdate: Subscribed true PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 00001826-0000-1000-8000-00805f9b34fb, characteristic: 00002ad3-0000-1000-8000-00805f9b34fb }
 2025-03-21T12:21:29.432Z INFO  rsperipheral::startup > CharacteristicSubscriptionUpdate: Subscribed true PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 00001826-0000-1000-8000-00805f9b34fb, characteristic: 00002ada-0000-1000-8000-00805f9b34fb }
 2025-03-21T12:21:29.499Z INFO  rsperipheral::startup > CharacteristicSubscriptionUpdate: Subscribed true PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 24e2521c-f63b-48ed-85be-c5330a00fdf7, characteristic: 24e2521c-f63b-48ed-85be-c5330b00fdf7 }
 2025-03-21T12:21:29.894Z INFO  rsperipheral::startup > WriteRequest: PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 24e2521c-f63b-48ed-85be-c5330a00fdf7, characteristic: 24e2521c-f63b-48ed-85be-c5330d00fdf7 } Value: [71, 0, 5, 20, 6D, 43, 31, 31, A8] Offset: 0

thread '<unnamed>' panicked at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ble-peripheral-rust-0.2.0\src\peripheral\winrt\win_event_handler.rs:254:51:
called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x8000001E), message: "已提交对象。" }
stack backtrace:
 2025-03-21T12:21:29.930Z INFO  rsperipheral::startup > received msg: [71, 80, 0, F1]
 2025-03-21T12:21:29.982Z INFO  rsperipheral::startup > WriteRequest: PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 24e2521c-f63b-48ed-85be-c5330a00fdf7, characteristic: 24e2521c-f63b-48ed-85be-c5330d00fdf7 } Value: [71, 1, 8, DB, 59, DD, 67, 20, 6A, 51, 0, CD] Offset: 0
   0: std::panicking::begin_panic_handler
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src\panicking.rs:692
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\core\src\panicking.rs:75
   2: core::result::unwrap_failed
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\core\src\result.rs:1704
 2025-03-21T12:21:30.045Z INFO  rsperipheral::startup > received msg: [71, 81, 9, 3, 0, 41, 31, F, 1, 0, 0, 0, 0, 0, 0, 0, 80]
   3: enum2$<core::result::Result<tuple$<>,windows_result::error::Error> >::unwrap
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688\library\core\src\result.rs:1109
   4: ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0::async_block$0
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ble-peripheral-rust-0.2.0\src\peripheral\winrt\win_event_handler.rs:254
   5: futures_executor::local_pool::block_on::closure$0<enum2$<ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0::async_block_env$0> >
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\futures-executor-0.3.31\src\local_pool.rs:316
   6: futures_executor::local_pool::run_executor::closure$0<tuple$<>,futures_executor::local_pool::block_on::closure_env$0<enum2$<ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0::async_block_env$0> > >
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\futures-executor-0.3.31\src\local_pool.rs:90
   7: std::thread::local::LocalKey<alloc::sync::Arc<futures_executor::local_pool::ThreadNotify,alloc::alloc::Global> >::try_with<alloc::sync::Arc<futures_executor::local_pool::ThreadNotify,alloc::alloc::Global>,futures_executor::local_pool::run_executor::closure
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688\library\std\src\thread\local.rs:308
   8: std::thread::local::LocalKey<alloc::sync::Arc<futures_executor::local_pool::ThreadNotify,alloc::alloc::Global> >::with<alloc::sync::Arc<futures_executor::local_pool::ThreadNotify,alloc::alloc::Global>,futures_executor::local_pool::run_executor::closure_env
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688\library\std\src\thread\local.rs:272
   9: futures_executor::local_pool::run_executor<tuple$<>,futures_executor::local_pool::block_on::closure_env$0<enum2$<ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0::async_block_env$0> > >
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\futures-executor-0.3.31\src\local_pool.rs:86
  10: futures_executor::local_pool::block_on<enum2$<ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0::async_block_env$0> >
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\futures-executor-0.3.31\src\local_pool.rs:316
  11: ble_peripheral_rust::peripheral::winrt::win_event_handler::impl$0::create_write_handler::closure$0
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ble-peripheral-rust-0.2.0\src\peripheral\winrt\win_event_handler.rs:229
  12: windows::Foundation::TypedEventHandlerBox<windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic,windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs,ble_peripheral_rust::peripheral::winrt::win_event_hand
             at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows-0.57.0\src\Windows\Foundation\mod.rs:3198
  13: DllGetClassObject
  14: DllGetClassObject
  15: DllGetClassObject
  16: DllGetClassObject
  17: TpReleaseWork
  18: EtwNotificationRegister
 2025-03-21T12:21:30.086Z INFO  rsperipheral::startup > ReadRequest: PeripheralRequest { client: "6a:3a:37:cf:0f:c8", service: 00001826-0000-1000-8000-00805f9b34fb, characteristic: 00002ad3-0000-1000-8000-00805f9b34fb } Offset: 0
  19: BaseThreadInitThunk
  20: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

thread '<unnamed>' panicked at C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ble-peripheral-rust-0.2.0\src\peripheral\winrt\win_event_handler.rs:254:51:
called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x8000001E), message: "已提交对象。" }
error: process didn't exit successfully: `target\debug\rsperipheral.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

smallzhan avatar Mar 21 '25 12:03 smallzhan

@smallzhan am using .unwrap in multiple places of windows implementation, i have to refactor windows implementation for proper error handling

rohitsangwan01 avatar Apr 30 '25 03:04 rohitsangwan01