zeromq / zbroker

Elastic pipes
Mozilla Public License 2.0
50 stars 11 forks source link

Problem: reads after write close asserts zbroker #39

Closed rpedde closed 10 years ago

rpedde commented 10 years ago
  1. Open read pipe and write pipe
  2. Write to write pipe
  3. Close write handle
  4. Read from read pipe

Assert: lt-zbroker: zpipes_server.c:516: look_for_pipe_reader: Assertion `self->pipe' failed.

rpedde commented 10 years ago

This is a little crazy, but I'm testing these semantics in python: https://github.com/rpedde/python-zbroker

Not sure if that's useful or not.

hintjens commented 10 years ago

Not crazy at all... its nice to see a Python API. I'll check the assert. On Apr 22, 2014 5:50 PM, "Ron Pedde" notifications@github.com wrote:

This is a little crazy, but I'm testing these semantics in python: https://github.com/rpedde/python-zbroker

Not sure if that's useful or not.

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/zbroker/issues/39#issuecomment-41057082 .

rpedde commented 10 years ago

meh... nm. this looks like a python binding issue, not a zbroker issue. Still likely something not quite right, but the repro instructions are wrong. It's the "test_many_writes" test.

rpedde commented 10 years ago

Actually, it looks like reads on a pipe where there is still outstanding data but the writer is closed and read size is greater than the size of the outstanding data doesn't return a partial read + 0, instead it blocks, and the subsequent close causes the assert.

I think.

hintjens commented 10 years ago

Right. The assert() shows inconsistent internal state, which should not be possible. I'll make a test case and then fix it.

On Tue, Apr 22, 2014 at 6:02 PM, Ron Pedde notifications@github.com wrote:

Actually, it looks like reads on a pipe where there is still outstanding data but the writer is closed and read size is greater than the size of the outstanding data doesn't return a partial read + 0, instead it blocks, and the subsequent close causes the assert.

I think.

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/zbroker/issues/39#issuecomment-41058766 .

hintjens commented 10 years ago

Could you regenerate the code in src using 'gsl -animate:1 zpipes_server.xml' and then 'make'? This will produce a debug view of the state machine leading up to the assert, which will help. Thanks!

On Tue, Apr 22, 2014 at 10:37 PM, Pieter Hintjens ph@imatix.com wrote:

Right. The assert() shows inconsistent internal state, which should not be possible. I'll make a test case and then fix it.

On Tue, Apr 22, 2014 at 6:02 PM, Ron Pedde notifications@github.comwrote:

Actually, it looks like reads on a pipe where there is still outstanding data but the writer is closed and read size is greater than the size of the outstanding data doesn't return a partial read + 0, instead it blocks, and the subsequent close causes the assert.

I think.

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/zbroker/issues/39#issuecomment-41058766 .

rpedde commented 10 years ago
14-04-22 18:21:43    125: writing:
14-04-22 18:21:43    125:     WRITE
14-04-22 18:21:43    125:         $ look for pipe reader
14-04-22 18:21:43    125:         > processing write
14-04-22 18:21:43    125: processing write:
14-04-22 18:21:43    125:     have reader
14-04-22 18:21:43    125:         $ pass data to reader
14-04-22 18:21:43    124: reading:
14-04-22 18:21:43    124:     have data
14-04-22 18:21:43    124:         > reading
14-04-22 18:21:43    125:         $ send WRITE_OK
14-04-22 18:21:43    125:         > writing
14-04-22 18:21:43    124: reading:
14-04-22 18:21:43    124:     expired
14-04-22 18:21:43    124:         $ close pipe reader
14-04-22 18:21:43    125: writing:
14-04-22 18:21:43    125:     reader dropped
14-04-22 18:21:43    125:         $ close pipe writer
14-04-22 18:21:43    125:         > writing
14-04-22 18:21:43    124:         $ terminate
14-04-22 18:21:43    125: writing:
14-04-22 18:21:43    125:     WRITE
14-04-22 18:21:43    125:         $ look for pipe reader
lt-zbroker: zpipes_server.c:516: look_for_pipe_reader: Assertion `self->pipe' failed.
Aborted
rpedde commented 10 years ago

I can gist a longer log if you want.