!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

893 Members
For people hacking on the Nix package manager itself191 Servers

Load older messages


SenderMessageTime
19 Sep 2021
@sternenseemann:systemli.orgsternias long as the referenced paths come from derivations18:58:30
@roberthensing:matrix.orgRobert Hensing (roberth)or from sources (path values, filtersource, that kind of thing)18:59:05
@derkha:matrix.orgKhaBoost coroutines have led to some GC issues (all fixed now though?) and are an issue on Cygwin. Has anyone thought about replacing them with C++20 coroutines? It might be too early to mandate C++20 support, but perhaps it would be worth supporting both impls for some time...21:16:06
@roberthensing:matrix.orgRobert Hensing (roberth) Kha: getting boehmgc and any kind of coroutines to play nice together is non-trivial. At least the boost coroutines expose some implementation details that allow us to inform boehmgc properly (although the way we do it isn't optimal yet). Any coroutine implementation will confuse boehmgc because it doesn't handle on its own the case where the stack pointer isn't in any known thread stacks. C++20 coroutines do not seem to have an allocator parameter or anything similar that would allow us to pass this info to the gc. I haven't delved deeply into this, but from the information I could find, no such interface exists 21:52:00
@roberthensing:matrix.orgRobert Hensing (roberth)any coroutine integration will have to solve two problems: 1. making boehmgc accept the 'weird' stack pointers; 2. making sure the coroutine stack gets scanned by the gc. The current integration uses independent solutions for both, which is not optimal. A C++20 implementation has to solve both problems too21:54:33
@roberthensing:matrix.orgRobert Hensing (roberth)there might be a way in which Nix could be refactored so that we only need to scan the evaluator's stack, so that we can configure boehm to scan only that stack. This would require a significant amount of communication between threads and an entirely new interface for working with this isolated evaluator. Such an interface would actually be useful for tracking Value provenance in a few locations where this is currently lacking, which improves error messages, but that's another topic I guess. Point is, with this much thread synchronization, it's easier and probably faster to just use threads instead of coroutines in the first place22:07:02
@roberthensing:matrix.orgRobert Hensing (roberth)coroutines are only used for working with streams in a synchronous style. In some cases this can be replaced by code that written in an async style. I'm not sure if we even have interactions with synchronous style libraries.22:09:41
20 Sep 2021
@cw:kernelpanic.cafeRev. CornWallace III (sun/tzu) changed their display name from CornWallace to Rev. CornWallace III.06:45:07
@tomberek:matrix.orgtomberek

While interacting directly with the nix-daemon I noticed that the response to exceptions/errors are sent to the client twice. Is this expected? This is a wopIsValidPath. daemon.cc looks like it sends STDERR_ERROR for the operation, and then sends another in the try-catch for the connection.

00000000: 6378 696e 0000 0000 0a01 0000 0000 0000  cxin............
00000010: 0000 0000 0000 0000 0100 0000 0000 0000  ................
00000020: 3500 0000 0000 0000 2f6e 692f 7374 6f72  5......./ni/stor
00000030: 652f 7a79 3962 636e 7932 3270 7931 3776  e/zy9bcny22py17v
00000040: 3037 3130 6339 7276 3269 6239 6a78 6136  0710c9rv2ib9jxa6
00000050: 7076 2d73 6f75 7263 652e 6472 7600 0000  pv-source.drv...

00000000: 6f69 7864 0000 0000 2001 0000 0000 0000  oixd.... .......
00000010: 7374 6c61 0000 0000 7074 7863 0000 0000  stla....ptxc....
00000020: 7100 0000 0000 0000 1b5b 3331 3b31 6d65  q........[31;1me
00000030: 7272 6f72 3a1b 5b30 6d20 7061 7468 2027  rror:.[0m path '
00000040: 1b5b 3335 3b31 6d2f 6e69 2f73 746f 7265  .[35;1m/ni/store
00000050: 2f7a 7939 6263 6e79 3232 7079 3137 7630  /zy9bcny22py17v0
00000060: 3731 3063 3972 7632 6962 396a 7861 3670  710c9rv2ib9jxa6p
00000070: 762d 736f 7572 6365 2e64 7276 1b5b 306d  v-source.drv.[0m
00000080: 2720 6973 206e 6f74 2069 6e20 7468 6520  ' is not in the
00000090: 4e69 7820 7374 6f72 6500 0000 0000 0000  Nix store.......
000000a0: 0100 0000 0000 0000 7074 7863 0000 0000  ........ptxc....
000000b0: 7100 0000 0000 0000 1b5b 3331 3b31 6d65  q........[31;1me
000000c0: 7272 6f72 3a1b 5b30 6d20 7061 7468 2027  rror:.[0m path '
000000d0: 1b5b 3335 3b31 6d2f 6e69 2f73 746f 7265  .[35;1m/ni/store
000000e0: 2f7a 7939 6263 6e79 3232 7079 3137 7630  /zy9bcny22py17v0
000000f0: 3731 3063 3972 7632 6962 396a 7861 3670  710c9rv2ib9jxa6p
00000100: 762d 736f 7572 6365 2e64 7276 1b5b 306d  v-source.drv.[0m
00000110: 2720 6973 206e 6f74 2069 6e20 7468 6520  ' is not in the
00000120: 4e69 7820 7374 6f72 6500 0000 0000 0000  Nix store.......
00000130: 0100 0000 0000 0000                      ........
06:54:33
@ninjatrappeur:matrix.orgNinjaTrappeur joined the room.09:25:17
@eelco:nixos.orgEelco 😴 changed their display name from Eelco Dolstra to Eelco 😴.11:26:41
@derkha:matrix.orgKha
In reply to @roberthensing:matrix.org
Kha: getting boehmgc and any kind of coroutines to play nice together is non-trivial. At least the boost coroutines expose some implementation details that allow us to inform boehmgc properly (although the way we do it isn't optimal yet). Any coroutine implementation will confuse boehmgc because it doesn't handle on its own the case where the stack pointer isn't in any known thread stacks. C++20 coroutines do not seem to have an allocator parameter or anything similar that would allow us to pass this info to the gc. I haven't delved deeply into this, but from the information I could find, no such interface exists

Ah, but that's the thing: C++20 coroutines are specified to be stackless: "they suspend execution by returning to the caller and the data that is required to resume execution is stored separately from the stack"

Custom allocation can be done via a custom Promise type or one that takes an explicit allocator

https://en.cppreference.com/w/cpp/language/coroutines

12:19:39
@roberthensing:matrix.orgRobert Hensing (roberth)does that guarantee that the stack pointer remains in the thread stack region?12:22:32
@roberthensing:matrix.orgRobert Hensing (roberth)and if it does, it doesn't seem like this could call into arbitrary code, which does seem to be something we need to make the whole sink/source translation business work12:23:38
@roberthensing:matrix.orgRobert Hensing (roberth)more specifically, that arbitrary code would not be capable of knowing how to yield12:24:48
@roberthensing:matrix.orgRobert Hensing (roberth)(I mean any C++ code we wrote, not the security almost-term "arbitrary code")12:26:39
@derkha:matrix.orgKha Does Nix even use more than that single coroutine in serialise.cc, which does not have a nested yield? In any case, afaiui you cannot have directly yield from inside a nested call with these coroutines, but you can yield to the surrounding coroutine, which then yields to the caller/next coroutine, etc. 12:34:20
@derkha:matrix.orgKha It's like Python before yield from 12:34:31
@derkha:matrix.orgKha * Does Nix even use more than that single coroutine in serialise.cc, which does not have a nested yield? In any case, afaiui you cannot directly yield from inside a nested call with these coroutines, but you can yield to the surrounding coroutine, which then yields to the caller/next coroutine, etc. 12:35:06
@derkha:matrix.orgKhaThere is absolutely no stack pointer manipulation with this approach12:35:38
@cw:kernelpanic.cafeRev. CornWallace III (sun/tzu) changed their display name from Rev. CornWallace III to Rev. CornWallace III (tzu/tzi).15:22:23
@cw:kernelpanic.cafeRev. CornWallace III (sun/tzu) changed their display name from Rev. CornWallace III (tzu/tzi) to Rev. CornWallace III (sun/tzu).15:24:44
@roberthensing:matrix.orgRobert Hensing (roberth) Kha: I'm going to trust you on that 15:29:53
@roberthensing:matrix.orgRobert Hensing (roberth)A possible issue is that these coroutines are "viral" in the sense that any stack frame between coroutine start and yield must become part of the coroutine. Some of these are virtual method invocations and some might be calls into libraries we don't control (not sure)15:31:42
@roberthensing:matrix.orgRobert Hensing (roberth)So those are possible challenges. I would really like for this to work and I suspect that C++20 may be a nicer requirement than boost_context, although I'm blissfully unaware of C++20 maturity15:33:08
@roberthensing:matrix.orgRobert Hensing (roberth)You could give it a try15:34:26
@derkha:matrix.orgKhaIt does sound fun. But to be honest, if that one tiny function really remains the only use of coroutines since it was introduced 3 years ago, I feel like the only reasonable approach is to replace it with a hand-written state machine :) . I might try that one first.15:46:05
@roberthensing:matrix.orgRobert Hensing (roberth) That includes such a code transformation on the nar parser and the Store interface for adding directories to the store with an arbitrary filter function, among potentially other things 16:47:28
@roberthensing:matrix.orgRobert Hensing (roberth)an async or state machine style nar parser will improve memory consumption in one case iirc, so that alone may be worth it16:48:16
@trofi:matrix.orgtrofi

nix build parallelism question: it looks like currently nix tries very hard to download everything from internet before attempting the build for things that certainly don't have binary substitutions.

Does nix have a knob (or could it be tweaked?) to start first required build sooner to get final result faster? It's a bit odd to see 3 hours if prerequisite download and 2 hours of actual build time. Example current state:

[0/2091 built, 16/898/1354 copied (9886.6/14818.7 MiB), 4775.8/6830.3 MiB DL] fetching source from https://cache.nixos.org

17:50:31

There are no newer messages yet.


Back to Room ListRoom Version: 6