Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • Courses
    • Certification
      • DataMiner Operator
      • DataMiner Administrator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
    • Video Library
    • Books We Like
    • Third-party Courses
    • DevOps Enablement Services
    • Quizzes
  • RESOURCES
  • Agile
    • Agile Webspace
    • Everything Agile
      • The Agile Manifesto
      • Best Practices
      • Retro Recipes
    • Methodologies
      • The Scrum Framework
      • Kanban
      • Extreme Programming
    • Roles
      • The Product Owner
      • The Agile Coach
      • The Quality & UX Coach (QX)
  • Expert Hubs
    • DataMiner DevOps Professional Program
    • DataMiner
      • DataMiner Releases & Updates
      • System Architecture
      • Integration Studio
      • Visual Overview
      • Security
    • Technologies
      • CI/CD
      • Converged Interconnect Networks
      • DOCSIS 3.1 / DAA
      • Elasticsearch
      • Kubernetes
      • Telemetry / Flow Monitoring
      • PTP
      • SDN / ST2110 / NMOS
    • Business
      • Software Business models
      • Perpetual Use or Usage-based Services
  • Discover
    • Markets
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Solutions
    • Use Case Library
    • DataMiner Dashboards
    • DataMiner Downloads
    • DataMiner Modules
      • Core features
      • SRM features
    • DataMiner Apps
    • Professional Services
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • Pricing
  • More
    • Feature Suggestions
    • Online DataMiner Systems
    • Leaderboard
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
    • Verify a certificate
  • >> Go to dataminer.services

How to remove QAction or group from stack when QAction gets stuck?

Solved168 views10th July 2023QAction stuck
5
Elmaza Kurtanović [SLC] [DevOps Advocate]103 7th July 2023 0 Comments

QAction calls an async method and gets stuck. I tried canceling the async method using timeout and CancellationToken, but the QAction is still on the stack. Is there any way I can remove it from the stack?


Elmaza Kurtanović [SLC] [DevOps Advocate] Selected answer as best 10th July 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
4
Floris Cockaerts [SLC] [DevOps Enabler]1.56K Posted 7th July 2023 3 Comments

Hi Elmaza,

There's no immediate way to abort a specific thread, however, have you tried to either:

  • Stop or restart the element?
  • If it isn't a production system, or the impact of reloading the data kept in scripting, you can kill the SLScripting process. It's one of the few processes that DataMiner will simply restart without restarting the agent.
  • Your last option is to restart the agent if this thread really needs to get off the stack and killing SLScripting would be too abrupt.

You may want to stop the element while the agent is down to avoid it entering into the same state again, for that, we have the Change Element States Offline tool.

Do you require any assistance with the implementation of the async method?

Elmaza Kurtanović [SLC] [DevOps Advocate] Selected answer as best 10th July 2023
Elmaza Kurtanović [SLC] [DevOps Advocate] commented 7th July 2023

Hi Floris,

Thank you for the answer.

The stack is cleared when the element is stopped, but this is repeated after each activation of the element.
I’m trying to find a way to avoid that QAction gets stuck. The async method being called is part of the Ember+ library.

Floris Cockaerts [SLC] [DevOps Enabler] commented 7th July 2023

Hi Elmaza,
I assume the problem you face will stem from the fact that a QAction’s Run method is not async itself.
Is your async method expected to return data as soon as possible, or is listening for a potential client to connect for example? For the latter case, you’ll want to offload your call to a separate thread I believe.
If you’re int he first case however, then I believe the approach would be to not use “await”, grab the task and wait on said task using your cancellation token. Do note that to cancel the token, you can’t just use a different trigger as the main thread will still be stuck waiting. You should either set your token to expire after a certain time, or let it run on a separate thread, so your Main function can be called to set the token.

Note that if you create threads, you may want to implement the dispose (https://docs.dataminer.services/develop/devguide/Connector/LogicQActions.html#implementing-the-idisposable-interface) to cancel the token when the element stops too.

Floris Cockaerts [SLC] [DevOps Enabler] commented 8th July 2023

As a follow-up, the Ember+ library has a lot of async functions, even though it expects everything to be executed from a single thread using their AsyncPump class. What we’re trying now is to launch this pump on a separate thread using a task that we can kill if it gets stuck, also using a CancellationToken.

0
Elmaza Kurtanović [SLC] [DevOps Advocate]103 Posted 10th July 2023 0 Comments

With the help of Floris, this problem seems to have been solved.
At the moment everything looks OK, we will monitor the situation for a few more days.

The solution was to add a CancellationTokenSource with a TimeSpan of 30s and modify the async method call from:

AsyncPump.Run(AsyncMethod, tokenSource.Token)

to:

var t = Task.Factory.StartNew(() => AsyncPump.Run(AsyncMethod, tokenSource.Token), tokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
t.Wait(tokenSource.Token);

Thanks Floris!

Elmaza Kurtanović [SLC] [DevOps Advocate] Answered question 10th July 2023
Please login to be able to comment or post an answer.

My Dojo Points

0 Credits
0 Reputation

Question Tag Cloud

adl2099 (54) Alarm Console (53) alarms (69) alarm template (58) API (34) Automation (143) automation scipt (65) Automation script (95) backup (54) Cassandra (141) cloud (36) Connector (44) Correlation (42) Cube (114) Dashboard (134) Dashboards (134) database (64) DataMiner Cube (37) DIS (53) DMS (48) DOM (66) driver (48) DVE (43) Elastic (73) Elasticsearch (99) elements (49) Failover (90) GQI (49) HTTP (45) IDP (54) low code app (68) low code apps (42) MySQL (50) protocol (145) QAction (56) resources (34) security (71) SNMP (55) SRM (266) SRM resources (37) timeout (35) trending (66) upgrade (44) Visio (370) Visual Overview (290)
Privacy Policy • Terms & Conditions • Contact

© 2023 Skyline Communications. All rights reserved.

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin