Simple TCP Proxy: Segmentation fault and error: can only marshal stream with unsafe flag #1253
-
I'm testing Janet, and so far, it's going really well, I'm currently creating a simple proxy in Janet, Hare, Erlang, and Rust to compare their speed. The results I've seen with Janet have been awesome, especially considering that I'm using a single thread, However, I have encountered two problems with my TCP proxy. proxy/init.janet:
First: I can not build exe with
Second: after sending some packets with simple client(running it multiple times), my proxy server segfaults
Simple Client:
Simple Echo server:
Any Advice? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Regarding the marshalling issue: |
Beta Was this translation helpful? Give feedback.
-
The segfault with the mark-phase of the garbage collector looks like a bug. My guess it is related to the newish code making |
Beta Was this translation helpful? Give feedback.
-
Oh oh. I'm on a holiday trip with no computer with me, so I can't join the debug fun, sorry. |
Beta Was this translation helpful? Give feedback.
-
Well, I warned you that I had no clue what I was doing, right :) |
Beta Was this translation helpful? Give feedback.
Regarding the marshalling issue:
You are making a connection as a top-level binding (listener).
When you build an executable, all top-level forms are executed prior to runtime, and then marshalled.
As the compiler says, you cannot marshal a stream (an existing connection), as you're creating it build-time.
Try creating it during runtime, using dynamics or any other method of moving that over into main (or another function).