Closed jeaye closed 7 years ago
I've updated the issue with a stack trace. To aid in troubleshooting, the issue happens if either of these swaps are present: https://github.com/ztellman/byte-streams/blob/master/src/byte_streams.clj#L123
That is to say, commenting out both allows me to do the :reload-all
with no issue.
This is almost certainly because Clojure blindly re-creates protocols when a namespace is reloaded, which causes incompatible (but identical) versions. I should be able to fix it by doing a check for whether the protocol already exists. Thank you for the report, and sorry to make you track it down. I'll update once a fix is available.
Thanks for the quick response; it looks like this is the same issue: https://github.com/overtone/overtone/issues/70
They fixed it by wrapping it in a defonce
: https://github.com/overtone/overtone/commit/2185920254976e441892485936ac7d1c65450f15
@ztellman I've currently worked around this by requiring byte-streams in a defonce, which basically is the same as wrapping every source file in one. That's not an ideal solution, but it means that I can actually reload my repl in-place.
The PR I have doesn't seem to resolve all of the issues, but it tackles some. Are you interested in resolving this? If not, will you please document the README to warn others to require it in a defonce
?
@ztellman To be clear, that PR doesn't fix all issues. I still see some issues with two Type
objects not being able to be compared, since each Type
apparently represents a different type. It doesn't happen on reload, though, it happens when using byte-streams after reload.
Sorry, I hit merge too quickly. The best fix for this is to wrap the protocol definition, not the conversions themselves. This approach won't fix any other conversions people have defined in their own code.
I've reverted the merge, and am working on a commit that uses this approach.
@ztellman So, my branch/PR fixes the issue of reloading, but it doesn't tackle everything. The best repro steps I have are listed below. Please open up a fresh repl and run each of these, in sequence. Assuming all has been fixed, there should be no errors. I've marked where things currently fail on both your master and my PR branch.
(require 'byte-streams-simple-check)
(require 'pushback-stream-test)
(require 'byte-streams-test)
(require 'clojure.test)
(clojure.test/run-all-tests)
(require 'byte-streams :reload-all) ; This fails on your branch
(clojure.test/run-all-tests) ; This fails on my branch
So when I run your example code, I get a spurious failure in one test the first time around, and a deadlock in the second. I'm not really quite sure what's going on in there, but I suspect it isn't related to the original issue. Can you confirm that this unblocks your :reload-all
workflow?
Checking now.
@ztellman It looks like that does the trick! Naturally, your fix is much more keen than my bumbling around; thanks for putting it in.
With that out of the way, before a new release goes out, are you interested in adding AOT and direct linking? I've made a PR.
I'm closing this; please let me know when you deploy a new release!
Here's an example repl session (from a fresh clone of byte-streams, with no other code):
This is breaking my development tooling, far down the dependency hole, but I've traced it back to byte-streams.