Comments (11)
Is there a way of telling the conversion path that a collection of byte-arrays to a single byte-array would take? It feels like there's something occasionally not being flushed.
from byte-streams.
What version are you using, and is the input a sequence or vector of byte arrays?
from byte-streams.
Hi - version is 0.2.0, I'm using a sequence but could easily be a vector.
from byte-streams.
More info: The problem never occurs when a vector is used. If I use a sequence, however, it fails occasionally/erratically. Here are the results of my test-suite.
FFPPPFFPPPPPPFPPPPPPPPPPF
where F=FAIL, P=PASS.
from byte-streams.
Can you test with the latest 0.2.1 beta? If it still fails, can you provide a reproducing case for me to run?
from byte-streams.
Testing with 0.2.1-alpha1 seems to cause occasionally hangs on my test-suite. I've tried a few different combinations, looks like occasionally the thread is blocking. I'll investigate further the exact nature of these hangs, and try to distill a better failing test.
from byte-streams.
So I've been trying to reproduce this on my end, using some variant of
(bs/to-byte-array (repeatedly 1e3 #(byte-array 1e5)))
I'm not able to, but I did notice that it hung when I ran this inside the byte-streams
namespace, since byte-array
is shadowed there. An error was logged, but it was otherwise stuck. This obviously shouldn't happen, and I've made a fix such that it logs and actually returns, but maybe this is why it was hanging for you? Let me know.
from byte-streams.
I believe I've reduced the problem down to a simple example here:
https://github.com/malcolmsparks/bs-bug/blob/master/src/bs_bug/core.clj
If you clone the repo
git clone [email protected]:malcolmsparks/bs-bug.git
This might not be the actual issue described above, or might be closely related to it.
If you try the bs_bug/core ns, you'll see the problem I'm having. It could be
that this is normal expected behavior from byte-streams and I'm assuming
this is a bug when it isn't.
The wider context is that I have to use this ->closing-stream function in
my tests that use ring-mock, because the request :body is an input stream.
This causes my tests to hang, but the actual code is working fine with real
browsers. It's a big of a snag, but isn't a huge issue, but would be nice
to understand why it's hanging.
from byte-streams.
This looks like a bug in the stream lifecycle handling. I'll take a closer look. Thanks for the reproducing case.
from byte-streams.
Okay, this was a little stranger than I expected. The problems were two-fold: manifold.stream/reduce
doesn't return an exception when given a non-stream input, and the closeable-seq implementation in byte-streams assumed everything it closed over was clojure.lang.IPending
. Both of these are fixed, in [byte-streams "0.2.1-alpha2"]
and [manifold "0.1.2-alpha1"]
, respectively. You'll need to wrap get-buffers
in s/->source
for your failing case to work, though.
from byte-streams.
Hi Zach, I've updated to both library versions and this has been working
well. Thanks, Malcolm
Malcolm Sparks
Director
Email: [email protected]
Web: https://juxt.pro
JUXT LTD.
Software Consulting, Delivery, Training
On 24 November 2015 at 03:23, Zach Tellman [email protected] wrote:
Okay, this was a little stranger than I expected. The problems were
two-fold: manifold.stream/reduce doesn't return an exception when given a
non-stream input, and the closeable-seq implementation in byte-streams
assumed everything it closed over was clojure.lang.IPending. Both of
these are fixed, in [byte-streams "0.2.1-alpha2"] and [manifold
"0.1.2-alpha1"], respectively. You'll need to wrap get-buffers in
s/->source for your failing case to work, though.—
Reply to this email directly or view it on GitHub
#20 (comment)
.
from byte-streams.
Related Issues (20)
- Unable to load byte-streams ns more than once HOT 11
- print-bytes calls .release ByteBuf? HOT 2
- Bytes are read from stream to String incorrectly HOT 8
- cannot compile due to No such var: p/min HOT 9
- lein uberjar fails with type hints in graph.clj HOT 12
- Use InputStream#transferTo? HOT 3
- Can't convert stream of byte arrays to seq of byte arrays HOT 1
- `closeable-seq` may end prematurely after GC? HOT 3
- Undeclared behavior for transfer {:close? true} HOT 2
- Lein javac options break on JDKs >= 12 HOT 1
- Reflection warnings in byte-streams.clj HOT 6
- "Don't know how to convert class manifold.stream.BufferedStream into class java.io.InputStream" HOT 1
- `:tag` metadata can be wrong
- Remove use of clj-tuple
- Deprecation of `byte-streams` namespace is undocumented.
- Late declarations of lower-cost conversions are ineffective HOT 3
- Lazy converter instantiation performance gotcha HOT 1
- Release 0.4.0? HOT 6
- Single-segment and clj-commons namespaces do not share conversion graph HOT 1
- `def-conversion` sometimes breaks when AOT-compiled 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 byte-streams.