Comments (5)
@czkz Check now for examples 1 and 3. Example 2 I think should still have some strange behavior, but that is because the construction is strange. I have not yet decided on why the correct behavior here should be - my current thought is that "edefer end" and "main end" should not print, but everything else should.
from janet.
The issue here seems to be with the os_shell function, and the fact that is implemented to run on a another thread, and then schedule the original fiber when it completes.
The second instance is a bit more complex, as the initial deadline cancellation triggers the second piece of code to run, which should also immediately expire the deadline.
from janet.
Hard to tell from just the valgrind output, but I think the invalid read is from calling strlen
on a symbol created by (gensym)
. Most function internal to Janet don't require a trailing 0 byte for strings, but all created strings should have such a byte just in case.
from janet.
The issue here seems to be with the os_shell function
Note: replacing os/shell with os/spawn resulted in the same behavior (but both are now fixed).
Check now for examples 1 and 3.
Example 1 is fixed for both os/shell and os/spawn.
Example 3 now produces less errors :)
the invalid read is from calling strlen on a symbol created by (gensym)
Indeed!
This example triggers the valgrind error (even on the new version):
(ev/cancel
(ev/spawn (ev/sleep 1e9))
(gensym))
It also spits random garbage in the error, e.g.
error: _00000r0Mw\
A
in _spawn [tst2.janet] on line 2, column 13
from janet.
I have not yet decided on why the correct behavior here should be - my current thought is that "edefer end" and "main end" should not print, but everything else should.
It could work as if edefer body was offloaded to a new fiber.
Not necessarily one-to-one, but something similar to this:
(ev/spawn
(ev/deadline 0.1)
(edefer
(ev/spawn # the only line different from example 2
(print "edefer start")
(os/shell "sleep 10 && echo sh_edefer")
(print "edefer end"))
(print "main start")
(os/shell "sleep 5 && echo sh_main")
(print "main end")))
output:
main start
error: deadline expired
edefer start
sh_main
sh_edefer
edefer end
from janet.
Related Issues (20)
- The default meson option `epoll=false` causes a busy loop and segmentation fault. HOT 10
- Proposal: Terse Chained Indices HOT 19
- Reimplement `slurp` with `os/open`. HOT 28
- A way to read standard input in the background without `file/read` in a thread. HOT 4
- `each` macro improper behavior? HOT 8
- `if-let` breaks tail call optimization. HOT 6
- false branch of `if-let` doesn't report the correct call stack information. HOT 4
- `ev/select` should not resume a dead task. HOT 4
- `try` and `defer` break tail call optimization. HOT 4
- `(= @"update" @"update")` is `false`. HOT 3
- `ev/select` still revives fibers.... HOT 3
- option to unbundle docstrings and potential consequences HOT 8
- splicing into structs/tables HOT 2
- Disasm/asm doesn't round-trip for function with unused argument HOT 1
- eventloop/networking gets stuck on musl HOT 11
- Consider making `module/paths` a dynamic variable HOT 7
- Can it run on iOS? Thank you. HOT 3
- `os/strftime` doesn't respect environment variables. HOT 3
- Re-integrate jpm into janet HOT 45
- recent change kinda breaks lexical scope with multiple modules HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from janet.