pirocks / simple-named-pipes-ipc Goto Github PK
View Code? Open in Web Editor NEWA Java/Kotlin IPC library using named pipes
A Java/Kotlin IPC library using named pipes
Thanks for writing this, I used it and found a bug.
When passing through an IntArray, on reading, it couldn't figure out the type from
contentsType.and(0x7f)
I couldn't think of a better shorthand so I just changed it to
val absolute = if(contentsType < 0) (-contentsType).toByte() else contentsType
Then used that. I'm sure you can think of something better. It seems to matter if it's a Byte or an Integer.
This was a tricky one.
In the method openPipes()
, it creates NamedPipe
s. If it throws because they already exist, it replaces the created ones with a different set of NamedPipe
.
The problem is, the original NamedPipe
had been created with a reference to an existing file. When the reference is broken, that instance is sometimes garbage collected. This calls finalize()
on NamedPipe
, which then calls close()
, which then deletes the file. But that file, by definition, is currently being used by some other client.
The visible symptom was that the NamedPipe
doing the reading (not the one that just got deleted) hangs when it's lazy loading its DataInputSteam
. That's because the file it's referencing is gone, and is never written to.
It only happened sometimes. Weirdly, when I wrote my own tests, they would hang if I ran one of the tests by itself, but worked fine when I ran more than one test. Dunno why.
The solution is instead of using try catch
in openPipes()
, check for the two files' existence before deciding what to create.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.