Code Monkey home page Code Monkey logo

Comments (11)

malcolmsparks avatar malcolmsparks commented on June 3, 2024

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.

ztellman avatar ztellman commented on June 3, 2024

What version are you using, and is the input a sequence or vector of byte arrays?

from byte-streams.

malcolmsparks avatar malcolmsparks commented on June 3, 2024

Hi - version is 0.2.0, I'm using a sequence but could easily be a vector.

from byte-streams.

malcolmsparks avatar malcolmsparks commented on June 3, 2024

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.

ztellman avatar ztellman commented on June 3, 2024

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.

malcolmsparks avatar malcolmsparks commented on June 3, 2024

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.

ztellman avatar ztellman commented on June 3, 2024

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.

malcolmsparks avatar malcolmsparks commented on June 3, 2024

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.

ztellman avatar ztellman commented on June 3, 2024

This looks like a bug in the stream lifecycle handling. I'll take a closer look. Thanks for the reproducing case.

from byte-streams.

ztellman avatar ztellman commented on June 3, 2024

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.

malcolmsparks avatar malcolmsparks commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.