opcua
opcua copied to clipboard
Upgrading actix-web
Hi all, I started working on upgrading the Actix-Web parts, but I stumble over an issue with Tokio.
Through OPCUASession.connect
the function get_server_endpoints_from_url<T>
is called and at the end an instance of Session
is dropped.
This causes a panic, because Tokio wants to enter a blocking region:
thread 'actix-rt|system:0|arbiter:3' panicked at 'Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.', ...tokio-1.32.0\src\runtime\blocking\shutdown.rs:51:21
I have found running-actix-web-using-tokiomain in Actix-Web's documentation, stating that block_in_place
will not work. Unfortunately the backtrace reveals exactly that:
13: core::ptr::drop_in_place<opcua::client::session::session::Session>
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be\library\core\src\ptr\mod.rs:497
14: opcua::client::client::Client::get_server_endpoints_from_url<ref$<str$> >
at ...\opcua\lib\src\client\client.rs:493
Any suggestions on how to fix this?
(The code has been forked here)