Skip to content
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

Large StreamBuffer requests do not block until fulfilled #17

Closed
mbaz opened this issue Sep 6, 2021 · 4 comments
Closed

Large StreamBuffer requests do not block until fulfilled #17

mbaz opened this issue Sep 6, 2021 · 4 comments

Comments

@mbaz
Copy link

mbaz commented Sep 6, 2021

julia> x=read(stream,100000000);
┌ Info: assertion debugging
│   nread = 20072
└   n = 100000000
ERROR: AssertionError: nread == n
Stacktrace:
 [1] read(s::SoapySDR.Stream{ComplexF32}, n::Int64; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ SoapySDR ~/.julia/packages/SoapySDR/ElzKN/src/highlevel.jl:538
 [2] read(s::SoapySDR.Stream{ComplexF32}, n::Int64)
   @ SoapySDR ~/.julia/packages/SoapySDR/ElzKN/src/highlevel.jl:534
 [3] top-level scope
   @ REPL[40]:1

Would it make sense to take the requested number of samples as a maximum, and let read return less than that?

@sjkelly
Copy link
Collaborator

sjkelly commented Sep 6, 2021

Yes I think that makes sense per read definition:

  read(s::IOStream, nb::Integer; all=true)

  Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

  If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or
  end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent.
  Note that not all stream types support the all option.

@sjkelly
Copy link
Collaborator

sjkelly commented Sep 8, 2021

With #18 this can be temporarily avoided with read(...; all=false), to return fewer than requested samples. We should handle this internally though, so let's leave this open to track.

@sjkelly
Copy link
Collaborator

sjkelly commented Sep 8, 2021

To clarify, we should handle larger buffers internally in SoapySDR if requested, and block until the data become available. Just like the behavior of any other IO stream.

@sjkelly sjkelly changed the title Reading too many samples fails Large StreamBuffer requests do not block until fulfilled Sep 8, 2021
@sjkelly sjkelly mentioned this issue Sep 11, 2021
@sjkelly
Copy link
Collaborator

sjkelly commented Sep 14, 2021

Should be fixed in #22. Please comment and reopen if otherwise.

@sjkelly sjkelly closed this as completed Sep 14, 2021
@sjkelly sjkelly mentioned this issue Oct 5, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants