Stream: contributing

Topic: Debugging Help


view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 02:23):

If anyone has ideas. They would be much appreciate a bit of help.

Somehow, updating how we use tcp streams broke stdin.

This commit: https://github.com/roc-lang/basic-cli/commit/b495041380615814bc2f163e0f1f61bfac39bf54

from the automatic-file-closing branch on basic cli. only touches tcp streams.

Somehow, whenever reading stdin on this branch, it immediately gets EOF.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 02:23):

There is a chance that I did something unsafe with pointers and it broke stdin, but that would surprise me.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 02:23):

valgrind doesn't find anything.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 05:59):

Trying to debug this a bit more, It seems that allocating a buffered tcp stream into the heap is where the issue arises. It kinda feels like I use the mmap and then stdin suddenly has no data anymore.

Makes me feel like I might be writing to entirely the wrong location and breaking something, but from what I can tell, I am correctly writing into the mmap.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 06:00):

hmm, actually the error comes through in roc, so it may be delayed.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 06:21):

Actually seems nondeterministic depending on the exact build config. All roc refcount prints look correct....still very lost.

Definitely a spooky action at a distance kinda bug that feels like a I rolled the dice and uncovered something that has always been broken rather than something this commit broke, but not sure.

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 23:20):

For now, just decided to revert the tcp change and move on.

view this post on Zulip Luke Boswell (Jul 17 2024 at 23:21):

So just looking at files then?

view this post on Zulip Brendan Hansknecht (Jul 17 2024 at 23:21):

Yeah, updating files to automatically close and adding in mmap


Last updated: Jul 05 2025 at 12:14 UTC