-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix support for 1.11 #244
Fix support for 1.11 #244
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #244 +/- ##
==========================================
+ Coverage 78.74% 83.10% +4.35%
==========================================
Files 9 9
Lines 367 367
==========================================
+ Hits 289 305 +16
+ Misses 78 62 -16 ☔ View full report in Codecov by Sentry. |
Removed JET from the tests because getting compat bounds is annoying... |
LGTM. |
This isn't quite ready to merge yet, the tests uncovered a weird bug 😬 s1 = Socket(PUB)
s2 = Socket(SUB)
ZMQ.subscribe(s2, "")
ZMQ.bind(s1, "tcp://*:5555")
ZMQ.connect(s2, "tcp://localhost:5555")
# Message(::Int) - construct from buffer size
data = rand(UInt8, 10)
m1 = Message(length(data))
# copy!(m1, data) <- this works
# m1[1] = data[1] <- this works (as far as a single element goes)
# This causes recv() to hang
for i in 1:1
m1[i] = data[i]
end
ZMQ.send(s1, m1)
@test ZMQ.recv(s2) == data I'm not really sure what's going on there, do you have any ideas? I'm guessing that we're hitting undefined behaviour or memory corruption or something. This is why CI is hanging. |
It seems to be an old bug too, I was able to reproduce it on v1.2.3. I guess this particular functionality was almost never used so the bug never appeared. And even weirder, doing a task switch from printing something will also fix the hanging. |
So if this code is exited the timer will fire: x = () -> begin
s1 = Socket(PUB)
s2 = Socket(SUB)
s1.sndhwm = 100
s2.rcvhwm = 100
ZMQ.subscribe(s2, "")
ZMQ.bind(s1, "tcp://*:5555")
ZMQ.connect(s2, "tcp://localhost:5555")
data = rand(UInt8, 10)
m1 = Message(length(data))
ZMQ.send(s1, m1)
t = @async @show ZMQ.recv(s2)
timer = Timer(2) do timer
@info "Sending"
ZMQ.send(s1, "foo")
end
wait(t)
close(timer)
end
x() But if the lambda is commented out and it's executed within a |
This is necessary because `IOBuffer.data` changed to being a `Memory` in 1.11. Also added a bunch of tests to cover the untested `Message` constructors (which is how this wasn't caught earlier). Found with JET.jl.
NVM, turns out this is just a ZMQ thing 🤦 It's the slow joiner problem: https://stackoverflow.com/a/15175698 Interesting demonstration of how different things can affect performance. |
See the commit messages for details, TL;DR
IOBuffer.data
became aMemory
in 1.11 so I made the oldMessage(::Array)
constructor into aMessage(::DenseVector)
to support it.