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

Avoid nesting tokio runtimes #484

Merged

Conversation

kate-goldenring
Copy link
Contributor

Signed-off-by: Kate Goldenring kate.goldenring@microsoft.com

What this PR does / why we need it:
OPC UA discovery is currently failing with the error Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context as described in #483. This is because for discovery, an OPC UA client is created and then dropped. The client uses an async TCP connection, which is dropped when the client is dropped. There are two nested runtimes, the spawned thread in discover and the TCP connection. To avoid this, the same runtime should be used rather than nesting, which can be done via spawn_blocking -- this is a good discussion.

Special notes for your reviewer:

Note: This PR fixes this bug, but a next iteration of this would be do consider creating an OPC UA client once rather than in each discover iteration.

If applicable:

  • this PR has an associated PR with documentation in akri-docs
  • this PR contains unit tests
  • added code adheres to standard Rust formatting (cargo fmt)
  • code builds properly (cargo build)
  • code is free of common mistakes (cargo clippy)
  • all Akri tests succeed (cargo test)
  • inline documentation builds (cargo doc)
  • version has been updated appropriately (./version.sh)
  • all commits pass the DCO bot check by being signed off -- see the failing DCO check for instructions on how to retroactively sign commits

Signed-off-by: Kate Goldenring <kate.goldenring@microsoft.com>
Signed-off-by: Kate Goldenring <kate.goldenring@microsoft.com>
@kate-goldenring kate-goldenring merged commit ee64ae5 into project-akri:main Jun 17, 2022
@kate-goldenring kate-goldenring deleted the opcua-async-bug-fix branch June 17, 2022 15:30
leoluKL pushed a commit to leoluKL/akri that referenced this pull request Sep 23, 2022
Signed-off-by: Leo Lu <leolu@microsoft.com>
leoluKL pushed a commit to leoluKL/akri that referenced this pull request Sep 23, 2022
Signed-off-by: Leo Lu <leolu@microsoft.com>
leoluKL pushed a commit to leoluKL/akri that referenced this pull request Sep 23, 2022
Signed-off-by: Leo Lu <leolu@microsoft.com>
leoluKL pushed a commit to leoluKL/akri that referenced this pull request Sep 23, 2022
Signed-off-by: Leo Lu <leolu@microsoft.com>
leoluKL pushed a commit to leoluKL/akri that referenced this pull request Sep 23, 2022
Signed-off-by: Leo Lu <leolu@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Akri DEV Helm Chart 0.8.12 - akri-opcua-discovery-daemonset Failure
3 participants