Tom94/tev

1.18+: IPC stopped sharing instaces by default?

KarelPeeters opened this issue · 6 comments

Since version 1.18 it seems that when launching tev for the second time it does not properly connect to the existing instance any more.

For example:

image

I launched tev in the left terminal first, which opened a new window as expected. Then I launched tev in the second terminal, it says it's connecting to the primary instance (which the left terminal confirms) but then still opens its own window.

I get the same issue on the 1.18, 1.19 and 1.20 released exe files, on 1.17 everything works as normal.

Did the behavior intentionally change? I checked the change-logs but couldn't really find anything.

Tom94 commented

Hi there, yes, this behavior is intentional: opening tev without any image arguments spawns a new window now (to allow people to open multiple instances side-by-side without passing images first). I think this is more intuitive than making $ tev a no-op if a window is already open.

That said, I hadn't considered the use-case of someone wanting to either open a tev render window or reusing an existing one if it's already there. I'll modify the CLI shortly to give you the option to revert to old behavior.

Tom94 commented

(Extra background info: the IPC connection that you see in your console logs is intentional. Even when multiple windows of tev are open side-by-side, there is still only a single "primary" window that receives IPC data. When this window gets closed, one of the secondary windows automatically promotes itself to become the new primary.)

Ah I see, that all makes sense but getting the old behavior back as an option would be very useful.

Could you elaborate on how the handover works when the primary window closes? I assume the original TCP socket still gets closed, and another instance opens a new one? Doesn't that kill exiting connections?

Tom94 commented

Yeah, the TCP socket gets closed, existing connections are killed, and the first secondary instance that manages becomes a new host that listens on the same port.

Given that the new host is a genuinely different tev instance with different images & state, I think the reset of the connection makes more sense than trying to keep the existing connection alive.

Tom94 commented

Of note: the intended function of this is that a subsequent $ tev image.exr doesn't spawn a new window if there are still existing ones -- i.e. as long as at least one instance of tev is running, one of them will handle IPC traffic.

As a corollary: the whole discussion concerns multiple tev instances that are bound to the same ip/port. If you were to spawn one regular tev instance and another via $ tev --host 127.0.0.1:1337, the second one would be its own independent primary instance.

Great, thanks a lot for explaining and the new flag!