-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows support WIP #3448
Windows support WIP #3448
Conversation
@Aexylus is attempting to deploy a commit to the Rocicorp Team on Vercel. A member of the Team first needs to authorize it. |
thanks for taking a stab at this. Those errors are likely coming from inside the
There is a reference to a file path for opening the replica db:
but presumably that is correct since it is coming from your config. Do your worker processes die before hitting any of the log lines in |
If you run under Looks like there is a bug in converting the worker path to an absolute path as the conversion results in a double Here's the offending code:
|
I think just swapping it to import via url rather than absolute path will fix it. So: const absModulePath = new URL(`../${modulePath}`, import.meta.url).pathname; needs to be const moduleUrl = new URL(`../${modulePath}`, import.meta.url); |
I'm starting to lose my mind a lil bit :D If I'm not mistaken the zero-cache-dev builds the schema and spawns mono/packages/zero/src/zero-cache-dev.ts Line 95 in b69fce3
the file below and waits for workers to be ready
In here it spawns the change-streamer and gets to around this line before I think the
So before Basically I can't find anything failing except the PS: I already fixed the path issue in let absModulePath = fileURLToPath(new URL(`../${modulePath}`, import.meta.url)); This issue I think nodejs/node#37845 |
This works on windows for me: #3450 can you try it on your end? "works" as in it starts but I haven't tested replication. Looks like you're further than me reading your latest message. Adding postgres to the mix now to see if it replicates too. |
Yeah, that works as well. Yep, I'm trying to make this works because turns out WSL kinda sucks. Twice in couple hours either vscode suddenly couldn't access newly created file. Or TS just died for a single file. And you have restart WSL to fix it. |
The changes I added in #3450 worked for me for getting replication working end to end. I did have a few problems with I get websocket errors when trying to connect from the browser though. Still need to figure that out. |
The issue with the replica file is AFAIK that it doesn't create the path if the folder doesn't exist. Also It's interesting that works for you because I still have the same issue. I'm editing the node_modules files in the hello example to make it easier. So I cloned the repo again and made only the changes in the PR and I still get the same error. That is no error just exit. When I was trying to make it work on WSL yesterday every time I forgot db path or the replica file was wrong it failed with a relevant error. But here nothing. It's the same even in clean Windows 11 VM except the exit code is different
|
path.relative(dirname, path.dirname(absoluteConfigPath)), | ||
path.basename(absoluteConfigPath), | ||
); | ||
|
||
relativePath = relativePath.replace(/\\/g, "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why'd you need this change? I would have thought that the slashes were correct due to the use of path
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what gets passed into the tsImport
..\..\..\..\..\..\..\..\..\apps\app\schema
file:///C:/zero/node_modules/.pnpm/@[email protected]/node_modules/@rocicorp/zero/out/zero-schema/src/build-schema.js
I can't find it now in the tsx codebase. But I'm guessing it can't deal with the mismatched slashes. I kinda gave up some time ago trying to understand how node handles paths and the differences between Windows and Linux/OSX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment on the line. Something like:
// tsImport doesn't expect to receive slashes in the Windows format when running
// on windows. They need to be converted to *nix format.
Stopping by to say that @aboodman and I figured out where the crash is coming from on Discord The ZERO_UPSTREAM_MAX_CONNS var defaults to 20 if not specified, while ZERO_NUM_SYNC_WORKERS defaults to $CPUS_AVAILABLE - 1. On a system with more than 20 cores this leads to an Because the I added optional piping of stdout and stderr (left it commented out) for when something like this happens again in the future. PR #3452 |
The dying out of nowhere is because as you said the child errors don't propagate. Which is weird because in WSL they do. Simple Another weird thing is that uncommenting
in the But the issue with that is that the child processes don't get killed upon exit. So after stopping the zero-cache in terminal you have to kill all the node processes manually. |
The process might be dying because with the default setting (silent: false) child errors need to be handled explicitly if they're caught in the parent E.g.: during initialization there's a Are you able to replicate the issue reliably? |
I guess so. I made clean repo, made the changes and enabled the child log. And without silent it fails the same way as before. But with it it works fine. (Or at least gets further and doesn't die, didn't fully test it's okay on the hello repo. But it works on my other repo)
|
path.relative(dirname, path.dirname(absoluteConfigPath)), | ||
path.basename(absoluteConfigPath), | ||
); | ||
|
||
relativePath = relativePath.replace(/\\/g, "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment on the line. Something like:
// tsImport doesn't expect to receive slashes in the Windows format when running
// on windows. They need to be converted to *nix format.
I think I traced the issue to a ...
With the
Also apparently it's not this specific |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WSL turned out to be a bit annoying so I'm trying to fix the Windows issues. Very WIP, more like exploration.
Fixing relativePath slashes and command spawns fixes the
zero-build-schema
andzero-cache-dev
not found errors.Both these changes seem to work fine in WSL.
Now it gets stuck here:
I'm guessing it might be another path issue somewhere, but the workers code is a bit more complex.
But I'm a bit stuck what to look for next. Will try more when I have some more time. I'd appreciate any insight.