2026/02/11

From Woozle Writes Code
Jump to navigation Jump to search
Wednesday, February 11, 2026 (#42)
Tuesday Wednesday Thursday posts:prev <this> next

So now it's doing this, and I don't know how any of my changes might have caused it:

Got to line 192 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->RNative() : RNative: STREAM TYPE: SSH2 Session
Got to line 214 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->DoCommand() : DoCommand 1: STREAM TYPE: SSH2 Session
Got to line 216 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->DoCommand() : COMMAND @SSH2: mysqldump -hlocalhost -uroot -pSum34thiIng 'information_schema'
Got to line 218 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->DoCommand() : DoCommand 2: STREAM TYPE: SSH2 Session
Got to line 192 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->RNative() : RNative: STREAM TYPE: stream

Same object (id345), but somehow the resource's stream-type has changed. Presumably it got assigned a new stream-resource somewhere in between those last two readouts, but... [spiral-eyes face]

...ah wait, got it (I think)!:

        $rStrm = $this->RNative();
// RNative() is set via QNative() when we ActualOpen()
        $rRecv = ssh2_exec($rStrm, $oCmd->AsString());
        #$rErrs = ssh2_fetch_stream($rRecv, SSH2_STREAM_STDERR);  // 2026/02/06 there are complications with this, apparently; see docs for ssh2_exec()
        $this->QNative()->SetIt($rRecv);

...so there's a (possibly the) problem: two different streams to keep track of, but I'm overwriting one with the other. Now I need to understand what they're each for....

I thought I had it sorted -- ssh2_exec() returns a readable stream, which is what we need to pass to Convey() (and does not need to be retained outside the function) -- but after multiple minor bugfixes, I'm now getting this nonsense still:

Got to line 219 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->DoCommand() : DoCommand 2: STREAM TYPE: SSH2 Session
Got to line 193 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->RNative() : RNative: STREAM TYPE: SSH2 Session
Got to line 124 in [WFe]/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php
 - id345 of [WFe]\IO\Aspect\Connx\Stream\Runner\Remote\cSSH2->PullBytes() : PullBytes: STREAM TYPE: SSH2 Session
PHP Fatal error:  Uncaught TypeError: stream_get_contents(): supplied resource is not a valid stream resource in /home/woozle/Sync/dev/local/v0.6/ferreteria/src/IO/Aspect/Connx/Stream/Runner/Remote/SSH2.php:125

...which I guess is because something is still calling cSSH2::PullBytes(), which should not be happening.

So then I started fixing that, repairing a short sequence of new bugs as each one came up, but now I've got this:

CLOSED ssh connection
zend_mm_heap corrupted

Apparently this happens when I try to create an object at a certain point -- but apparently it doesn't matter what kind of object... so I guess the heap is already corrupted by that point, and this is just where the error surfaces (presumably because I'm doing something that requires the heap).

Unfortunately, there doesn't seem to be any rigorous way of detecting heap-corruption. SplHeap::isCorrupted() doesn't tell you anything about the heap, but only any SplHeap-descended objects you may have created. All I can do, then, is assume "new object;" is a reliable-enough detector...