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.

When first and last cycle are out of date, should we try refreshing them and retrying before we throw?

See original GitHub issue

In StoreTailer.toEnd, we get the lastCycle which is only checked against the file listing every 60s. In the event we’ve got lastCycle then failed to retrieve it from the SingleChronicleQueueStore is it worth forcing a directoryListing.refresh(true) and retrying before throwing an exception?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
glukoscommented, Oct 13, 2021

I’m ok with closing this.

In my understanding, https://github.com/OpenHFT/Chronicle-Queue/issues/924 is mostly about performance. It will save us from unnecessary refreshes, but it will not fix a data race - obviously, WatchService doesn’t priovide any guarantees on how fast events will arrive. As I see it, the initial purpose of refresh was dealing with manual manipulations with queue dir. Ideally, we shouldn’t rely on the refresh to resolve data races that happen in normal workflow.

Some more spit-balling - that’s how tailers should find out that a new cycle is created:

                    if (!readOnly && createIfAbsent && wire.writeFirstHeader()) {
                        // implicitly reserves the wireStore for this StoreSupplier
                        wireStore = storeFactory.apply(that, wire);
                        wire.updateFirstHeader();
                        wire.usePadding(wireStore.dataVersion() > 0);

                        wireStore.initIndex(wire);
                        // do not allow tailer to see the file until it's header is written
                        directoryListing.onFileCreated(path, cycle); // increments shared variable
                        // allow directoryListing to pick up the file immediately

Firstly, we write header to a mmapped memory, then we increment shared counter. Tailer in another thread / process may go here:

                if (!createIfAbsent &&
                        (cycle > directoryListing.getMaxCreatedCycle()
                                || cycle < directoryListing.getMinCreatedCycle()
                                || !path.exists())) {
                    return null;

and find updated getMaxCreatedCycle(), but !path.exists() way be true as per file creation hasn’t been synced by OS yet. Should we consider spinning for a while here before returning null?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode 13.1 will gets "stuck" on iOS Monterey/ New 2021 pro
I have a 2016 MacBook Pro and a 2014 Mac mini that have been downloading and "installing" Xcode now for 3 days. They...
Read more >
Axios Interceptors retry original request and access original ...
when the token is successfully refreshed, I retry the AXIOS request using an updated config - including the new fresh token and setting...
Read more >
Retrying event-driven functions - Google Cloud
When you enable retries on an event-driven function, Cloud Functions will retry a failed function invocation until it completes successfully or the retry ......
Read more >
How a RESTful API server reacts to requests - O'Reilly
Learn how to properly design RESTful APIs communication with clients, accounting for request structure, authentication, and caching.
Read more >
Working with Amazon SQS messages - AWS Documentation
Processing messages in a timely manner. Setting the visibility timeout depends on how long it takes your application to process and delete 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