question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async ACK handling can block indefinitely

See original GitHub issue

As a gate in the publish function, the publish routine will put a None marker on the blocking queue, which will block as designed if the queue is full:

await self._pending_pub_acks_queue.put(None)

However, the marker is only remove from the queue if the item is ACK’d. If the ACK never arrives, either in the synchronous or asynchronous case, the marker is not removed from the queue. Over time, if there are enough dropped ACK’s the _pending_pub_acks_queue will fill, blocking publishing indefinitely.

In addition, for the async case, there’s no way for the caller to remove the outstanding ACK element in ‘self._pub_ack_map’ directly if the ACK never arrives. It would either have to hack it or fake the callback. Also,

            cb = self._pub_ack_map[pub_ack.guid]
            await cb(pub_ack)
            del self._pub_ack_map[pub_ack.guid]

Should be written as:

            cb = self._pub_ack_map[pub_ack.guid]
           del self._pub_ack_map[pub_ack.guid]
            await cb(pub_ack)

To defend leak on exception in the callback.

To remedy, either the library should manage timeouts much like the golang equivalent, or an api should be provided for the user to cancel an outstanding asynchronous publish.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
madireycommented, Dec 3, 2018

+1

0reactions
scunninghamcommented, Dec 6, 2018

Looks like it will block if you get enough ACK drops in the synchronous case as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async: What is blocking? - Alice Ryhl
This can be a major issue because it means that other tasks on the same runtime will stop running until the thread is...
Read more >
Async and non blocking concepts in java. Is it possible to be ...
However, the thread will almost never block(See comments) and wait until someone connects or write to the socket, it will simply keep looping...
Read more >
Understanding the Event Loop, Callbacks, Promises, and ...
To do this, you will first learn about the original way to ensure asynchronous code is handled correctly by the event loop: callback...
Read more >
Advanced concurrency and asynchrony with C++/WinRT
The get function blocks indefinitely, while the async object completes. Async objects tend to be very short-lived, so this is often all you...
Read more >
Server Asynchronous Response Processing - dennis-xlc
These clients would make an HTTP GET or POST request and just block indefinitely until the server was ready to send back a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found