2026/10/15

From WoozleCodes
Jump to navigation Jump to search
Thursday, October 15, 2026 (#288)
prev ⇐ Wednesday Thursday Friday ⇒ next

References

Main Work

Still working on DBA, which is now dumping each schema using the previous schema's filename.

Signal Rambling

I'm currently trying to figure out why a resource variable (Woozalia\Ferret\Sys\InOut\Connx\Stream\caRsrc::$RStrm) is being accessed before the stream has been opened, which would set the variable. The *proximate* cause is that the function which is accessing it is supposed to be opening it, which might seem like a problem *except* for the fact that all it's doing is checking to see if it's a resource, which obviously it isn't, but passing it to that function requires it to be set, which it isn't.

The easy fix is to check it with isset() *first*, but that kind of begs the question of why it wasn't set *first*, because in this particular case the responsibility for opening it is outside of this class. I think.

...and that ambiguity is probably pointing pretty clearly towards what the actual problem is.

One approach would be to go ahead and patch it so an error doesn't get thrown *there* but instead tidily returns an "IsOkay" of FALSE, which *should* cause the caller to do something, and maybe that would be useful.

...but I already know who is calling it, so it seems kind of like trying to sweep the problem under the rug if I do that, and I think I need to figure out what was supposed to set it in the first place.

The only real improvement I can make here is if this lets the code show a more helpful error message, like "You tried to open this when it's not ready to consider itself open", hopefully with some details.

...but again, it seems more worthwhile to go back up to the level where the top of the whole opening-stack gets called.

...and part of the problem with this whole process is environmental noise (people talking loudly) in the immediate vicinity, but I don't currently have another good workspace (that's another work in progress).

So, working with my reduced input-window, let me nose around in the calling code, which is where ferreteria/src/Sys/Data/Engine/endpt/Client/MyMar.php(137) calls Woozalia\Ferret\Sys\InOut\Connx\run\cSession->DoInOutLoop() which then calls Woozalia\Ferret\Sys\InOut\Connx\aux\A\cCanals->Open(). Probably something is supposed to happen between those last two lines which sets the resource by opening the connection with ssh2_exec()...

Okay, it should have been opened *before* that was called.

...so I need to look at ferreteria/src/Sys/Data/Engine/endpt/Client/MyMar.php(137), and what happens before that call.

The Session object *was* supposedly opened back on line 114, which suggests that the problem is that the resource (which has in fact been got) isn't ending up in the Stream object ($RStrm property) where we're trying to check it.

The call to open the Session eventually goes to Session->ActualOpen() (line 127 of Session.php), but there's no mention of resources there -- which probably makes sense: I think this is too high-level to be dealing with implementation details like resources...

...aha, it looks like some resource-stuff is maybe supposed to happen in Session->OpenStrms()...

Ok, still too high-level -- but that fx gets the value of e.g. the Process's $OStrmOu property, which... if it's not ready to go, then retrieving it should trigger something which *makes* it ready...

Ok, so here's where things get a little bit complicated(er): there's both a *portal* and a *process* to open and shut.

  • The portal has to be open before we can run the process.
  • The process has to be running before we can open the streams.
  • ...and that is in fact the order in which Session->ActualOpen() does stuff. So far, so good.

...so Process->Open() gets called, which calls Process->ActualOpen(), which calls Process->Run(), which calls ssh2_exec() which creates the resource and sets Process->OStrmOu->RStrm.

Screen output indicates that this code *is* being executed.

The problem doesn't seem to happen with either of the stdio streams, but only with stderr... hmm.