
read
on the server is blocking when the input is small even after a (flush-output)
from the client side. I can’t remember what’s the magic bit to make it read anyway. Any clue?

Can you close the port?

nope

If I do read-line
instead, it works though (but then I need to read from the string)

Can the client send a newline?

It already does

(otherwise read-line
wouldn’t work)

Interesting

What’s the content that is being read / sent?

s-exp

Also, does this always happen? Or just only for some s-exp?

So basically this works: (with-input-from-string (read-line) read)
, but not a mere read

Possibly the issue is with symbols

though I’m not sure

What if you do (file-stream-buffer-mode the-tcp-input-port 'none)
?

That was a good idea, but it doesn’t seem to work

Do you know what are the last few characters that are being read?

nothing has been read yet

it’s blocking on the first things

And I don’t see any magic in mflatt’s experiment on places: https://github.com/racket/racket/blob/master/pkgs/racket-benchmarks/tests/racket/benchmarks/places/place-processes.rkt

apart maybe from using fasl

Is the text of the line something you can share?

'ready

with newline at the end, right?

(writeln 'ready)
(flush-output)

@sorawee although in place-processes it doesn’t seem necessary: https://github.com/racket/racket/blob/master/pkgs/racket-benchmarks/tests/racket/benchmarks/places/place-processes.rkt#L50

This also blocks: (writeln '(ready))
(flush-output)

And (with-input-from-string (read-line) read)
returns 'ready
?

yes

(with the slight difference that I’m reading from an input port, piped by process*/ports
)

It seems likely that I’m missing something about the context. The only case I can think of where read-line
would return and read
wouldn’t on the same input port are cases where read
would produce eof
or it would error trying to read the line by itself.

But then (with-input-from-string (read-line) read)
wouldn’t work either I guess

A long time ago, there was a bug in DrRacket (on my machine at least) where entering 'a
in the interaction window didn’t output anything, then entering a number made both be read. Maybe unrelated though.

Could be a linux problem. I’ll try to write a MWE tomorrow