sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

eliminate dependency of our Jupyter implementation on enchannel-zmq-backend #7040

Closed williamstein closed 2 months ago

williamstein commented 11 months ago

Motivation: enchannel-zmq-backend depends on rxjs, which is a 16MB npm package. It would be nice to not have to download this 16MB.

enchannel-zmq-backend is used for our jupyter communication. But rxjs it's a HEAVY dependency for that provides a lightweight wrapper around zeromq itself. I think we should just directly use zeromq. The enchannel package is really one file of code that is about 250 lines. We can surel rewrite it using a little class with an event emitter, and eliminate this rxjs dependency, which I think we use nowhere else.

williamstein commented 11 months ago

Note -- rxjs compresses via tar zcvf to less than 1MB. So let's keep this in perspective. This is one of those "someday" 1% projects...

williamstein commented 11 months ago

I have an entirely new good reason to rewrite this dependency. We use it like this in kernel.ts:

    this.channel = await createMainChannel(
      this._kernel.config,
      "",
      this.identity,
    );

It turns out that if the kernel immediately dies, e.g., the executable doesn't exist, then the await createMainChannel just hangs forever. I don't see any option to get around that. I.e., this is written badly with an assumption of "everything works", instead of "things sometimes go wrong".

williamstein commented 2 months ago

then the await createMainChannel just hangs forever.

Actually, maybe it hangs for one minute. And maybe that's the expected behavior. This seems closely related to https://github.com/sagemathinc/cocalc/issues/5582

williamstein commented 2 months ago

I'm closing this for now, since there is no compelling reason to do this.