raunioroo
raunioroo
DDeno
Created by raunioroo on 3/12/2024 in #help
Kill deno process tree
How would you kill a Deno process tree as in, force kill of Deno process and any of it's subprocesses? Deno.killappears to possibly leave subprocesses alive. Ideally using Deno.ChildProcess API, but I highly suspect it's not possible using the runtime API; I would also be happy with just a linux command I could run along with the PID! (I'm not that well versed with linux commands and process stuffs, so far I've been using killall deno which definitely works but would be nice to target only a specific process tree)
5 replies
DDeno
Created by raunioroo on 3/11/2024 in #help
How to troubleshoot runaway (100% CPU) deno process
Deno has been running a couple of websites rock solid for many months. But during last week or so I've had the server (using Deno.serve()) go unresponsive twice. That is, connection times out and I can see 100% CPU usage for the Deno process. No idea if it's a Deno bug, or bug in my code (like a blocking infinite loop or something). Thing is, I have no stacktrace, console.log output, or error logs to work with. I only know Deno process is stuck with something, using a lot of CPU and unable to serve requests (connection times out). Problem is I don't know where it is stuck. I do push new versions out every couple of days or so, as well as update deno to latest version regularly. Both deno and my own code has changed in this timeframe so I can't really say whether this problem is related to some version of Deno, or is it related to my userland code updates. Is there any way to perhaps stop/interrupt a running Deno process from the outside and get some info what it was doing at the moment to try and find the problem? Again not sure if it's Deno internal problem, or a problem with my userland code, or a problem in some third party library. No hints in stdout/stderr. I have no idea how to reproduce the issue other than letting it run on production server and just wait perhaps days or weeks for the issue to manifest. Since this only happens rarely, on production server, obviously I'd like to run any diagnostics or tracing tools quickly to then kill deno and restart the process as soon as possible. 🤔
9 replies
DDeno
Created by raunioroo on 2/26/2024 in #help
Deny env permissions silently (without throwing)
Hi. An npm module I'm using tries to read, or rather check for an existence of an env variable. The problem is it throws due to not having permission to access env. I'd rather not give any env permissions to any of my scripts. I think the offending npm module can do with having env variables undefined, it's just that it throws just trying to see if the variables are there. Can I somehow make Deno silently return empty/null without throwing an error? (if it's any importance, the offending module is npm:deepl-node , which uses npm:axios, which tries to see if there is something in NODE_EXTRA_CA_CERTS and is then unable to handle the access denied exception)
4 replies
DDeno
Created by raunioroo on 1/10/2024 in #help
LSP complains about missing package mongodb
No description
2 replies
DDeno
Created by raunioroo on 12/11/2023 in #help
await writer.write(buffer) never resolves on Deno.Command
Hiho. I'm creating a Deno.Command that writes a buffer to vipsthumbnail via stdin (and reads the result via stdout). It works most of the time, but sometimes gets stuck on await writer.write(source);. Source is the result of await Deno.readFile(path). The big problem is that there is no error, the writer.write() promise is just never resolved. So I have no idea how to debug, catch errors or even cancel this after timeout or something. I can process a couple of files (all with a new Deno.Command) but then after a few files it gets stuck and the promise never resolves. Any ideas how to begin solving what the problem is.
const cmd = new Deno.Command(this.vipspath + this.vipsthumbnail, {
args: args,
stdin: "piped",
stderr: "piped",
stdout: "piped",
}).spawn();

const writer = cmd.stdin.getWriter();
console.log("START WRITING", typeof source, source.byteLength);
await writer.write(source); // <--- STUCK HERE MAY NEVER RESOLVE
console.log("YAY! WE GOT HERE");
await writer.ready;
await writer.close();
const cmd = new Deno.Command(this.vipspath + this.vipsthumbnail, {
args: args,
stdin: "piped",
stderr: "piped",
stdout: "piped",
}).spawn();

const writer = cmd.stdin.getWriter();
console.log("START WRITING", typeof source, source.byteLength);
await writer.write(source); // <--- STUCK HERE MAY NEVER RESOLVE
console.log("YAY! WE GOT HERE");
await writer.ready;
await writer.close();
26 replies
DDeno
Created by raunioroo on 12/9/2023 in #help
wasm-vips file does not exist
Ok this is not directly a deno thing, but anyway. Has anyone successfully used wasm-vips with vips.Image.newFromFile(path);? For me vips.Image.newFromBuffer(buffer) works well. But opening local files directly for example vips.Image.newFromFile('sample.jpg')always complains:
error: vips::Error: unable to load from file sample.jpg
VipsForeignLoad: file "sample.jpg" does not exist
error: vips::Error: unable to load from file sample.jpg
VipsForeignLoad: file "sample.jpg" does not exist
I thought it would be an issue of relative paths, but I tried all kinds of relative paths (relative to Deno.cwd(), or import.meta.url, or the directory where vips-es6.js is stored), with no luck. Furthermore I tried a simple filename without path, and put a sample.jpg in every directory I could think of where it might try to load it. No luck. Am I missing something, or is this is a bug with wasm-vips on deno?
4 replies
DDeno
Created by raunioroo on 10/17/2023 in #help
How to actually sign out using deno_kv_auth
Not sure if bug or feature, but I have problems signing out from deno_kv_auth. I'm using Auth0 for testing, but actually the kv auth live demo at https://kv-oauth.deno.dev/ has the same issue, using GitHub provider. Basically, when first visiting the demo, and signing in, you get the GitHub login screen to authorize the sign in. All ok, sign in works. But then you sign out. Yes the session is cleared from the local server, but if you then click sign in again, you don't get the GitHub/Auth0 login screen, but instead get immediately authenticated with the previous credentials, and returned with a new successfully authenticated session. This is a problem of course, as there is no way to switch users, or sign out as you would do when using the site from a borrowed computer or whatever. Is there a way to completely sign out, so that I can again choose to accept or reject the authentication from the actual GitHub/Auth0/other provider oauth screen?
8 replies
DDeno
Created by raunioroo on 3/5/2023 in #help
How to prevent std/http from gzipping and overriding Etag
It appears deno std/http applies gzip content-encoding magically sometimes depending on the type of data served. This is unexpected to me, will override manually set Etags with a weakly validated one, and it seems there is no way to disable this behaviour. Or is there? If I create a Github issue about this, should it go to deno_std or does this behaviour come from underlying http impl code in deno core?
6 replies
DDeno
Created by raunioroo on 12/2/2022 in #help
TTY vs console.log vs stdin and setRaw for dummies?
Hi all! Would someone be able to clear some things out with regards to deno inputs and outputs: - what exactly is one referring to, when talking about TTY? (in deno) is it just another name for console, or some of the std streams (stdin/stdout/stderr) - what about raw mode? there has been Deno.setRaw() but apparently removed in Deno 1.26. I think there was at some point a writer/reader/stream.setRaw() method or somesuch, but they maybe disappeared too. What is raw mode supposed to do, and can one enable it in the current Deno version somehow. - does deno do a lot of processing on console.log(stuff) versus writing raw bytes to std streams? What kind of processing, if any? And is the amount of processing the same whether deno is running on a windows terminal/vs code terminal, or as a child process of another deno process? - if there is a raw mode, does it apply to stream write, or just console.log? Asking because basically just wanting to learn. And I'm doing something that involves a lot of message passing (JSON lines) between deno processes/subprocesses. At the moment I'm just reading stdout stream to get messages back from child process, and writing to stdin.getWriter() to send messages. It's performing fine, but I anticipate the amount of messages will grow pretty big, and would like to make it as fast/lightweight as possible.
40 replies
DDeno
Created by raunioroo on 11/4/2022 in #help
can't load external modules when run as child process with Deno.spawnChild
Hi! This is really weird, but I'm trying to run deno scripts under another deno process with Deno.spawnChild(Deno.execPath(), {...}) Problem is the subprocess deno is unable to load any remote dependencies (mongo here just an example, even std modules fail to load): error: Uncaught (in promise) TypeError: error sending request for url (https://deno.land/x/mongo@v0.30.0/mod.ts): error trying to connect: dns error: A non-recoverable error occurred during a database lookup. (os error 11003) If I run the same scripts straight from the command line, everything works ok, this only happens when deno is running as child of another deno process, for some reason. I have no idea how to even start to untangle this, maybe I'm overlooking something obvious... This is on Windows 10 btw.
2 replies