Comments (9)
Thanks for the update :) I did run an overnight test as well, but didn't find anything.
Maybe you are experiencing thread pinning, as part of your blocking call? This can be traced by adding -Djdk.tracePinnedThreads=full
(see e.g. https://todd.ginsberg.com/post/java/virtual-thread-pinning/)
from jox.
Hm that's very suspicious. No, there's nothing time-based in the code. I know it's hard to reproduce, but the Channel.toString
dumps a lot of internal representation information, which might help to debug such issues.
Is there some specific pattern of production/consumption that you are using, that might help to reproduce the problem?
from jox.
Let me try the Channel.toString. I have also added a check for isClosedForReceive() - was only checking isClosedForSend so far.
Using jox more or less out of the examples with a little wrapper around it - see:
https://github.com/svenkubiak/mangooio/blob/feature/8.5.0/mangooio-core/src/main/java/io/mangoo/async/EventBusHandler.java
from jox.
Indeed this seems like rather ordinary usage
In addition to the testsuite (which includes benchmarks sending many messages), I'm also running a simple two-thread send-receive loop locally, so far 47298000000 messages have successfully been sent & received ;)
If you'd have some more information, that would be great.
from jox.
I am quite sure that this is caused by the virtual thread that my receive() call is wrapped in. Looks like this is not intended for a blocking call. I have made some adjustments in my code and going to run further tests. But I am absolutely convince that this it not related to jox at all.
from jox.
While I was quite certain that switching from a virtual thread to a platform thread would fix my issue, unfortunately it didn't. Stopped receiving after around 12 hours as before. While I was further investigating this I noticed that in the doReceive() method there is a check regarding the segment id
if (segment.getId() != id)
If this would match equal, then doReceive would end up in an infinite loop not receiving. What would be the situations when this could happen?
As this is not mentioned in the readme, your recommendation for have a constant received would be to put the receive() in an infinite loop, right? So something like this:
Thread.ofVirtual().start(() -> {
try {
while(true) {
var payload = channel.receive();
//handle payload
}
} catch (Exception e) { //NOSONAR
...
}
});
I have adjusted my implementation again and doing additional tests now.
from jox.
If you are referring to this line, on the next iteration it will re-read the receiveSegment
value, and it should already be move forward. This might only happen if there are concurrent receives happening - which I don't think is the case here (when another recevie()
moves forward the segment). The segment is moved forward in findAndMoveForward
.
Yes, the loop looks right. Maybe try catching & logging a Throwable
, so that e.g. OutOfMemoryError
is also discovered? Or better, installing an uncaught exception handler.
Did you try capturing the stack trace?
from jox.
If you are referring to this line, on the next iteration it will re-read the
receiveSegment
value, and it should already be move forward. This might only happen if there are concurrent receives happening - which I don't think is the case here (when anotherrecevie()
moves forward the segment). The segment is moved forward infindAndMoveForward
.Yes, the loop looks right. Maybe try catching & logging a
Throwable
, so that e.g.OutOfMemoryError
is also discovered? Or better, installing an uncaught exception handler.Did you try capturing the stack trace?
Yes, I did. And after a lot of digging, it turned out to be an OutOfMemoryError Exception in an InfluxDB connection which was part of the what the receive() was handling. That was one of the stranges behaviours I have seen. The whole application kept behaving normal in some parts.
Thanks for your support!
from jox.
Ah, good to hear it's resolved :)
from jox.
Related Issues (20)
- Try using VarHandles & fields instead of Atomics in Channel HOT 1
- Consider using a different build system HOT 2
- Add module-info
- Change package to com.softwaremill.jox
- Make Channel final
- Remove nesting of exceptions/ChannelClosed
- Consider adding concurrency tests using JCStress
- Consider renaming `done()` to `close()` and implementing `AutoCloseable`
- Support default clauses in selects
- In select, return Done only when all channels are done
- Improve performance tests
- Add isClosedForSend / isClosedForReceive
- Remove filtering done channels in select
- Potential memory leak when the channel only sees interrupted sends
- Allow using Future-s in select
- Add a broadcast channel, also usable in select
- Add reactive streams interoperability
- Add a wrapper exception when rethrowing exceptions in send/receive HOT 1
- Consider not throwing ExecutionException in structured scopes HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jox.