Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run multiple Photino applications at once #188

Closed
cubedparadox opened this issue May 30, 2024 · 4 comments
Closed

Can't run multiple Photino applications at once #188

cubedparadox opened this issue May 30, 2024 · 4 comments

Comments

@cubedparadox
Copy link

I've recently noticed a pretty glaring issue with Photino - if one Photino app is already running, then all subsequent Photino windows will render a white screen.

  • I assume this bug is due to the background UI web server colliding on the local port/URI it's hosting on.

Here's what happens if I launch the Photino Sample React app, followed by the Photino Sample TestBench app:
explorer_sickcovlgz
And here's what happens if I run then in the reverse order.
explorer_FyBXNShDgl

I've tried a bunch of misc configuration stuff to try and work around this issue, but haven't found a good fix yet.

This occurs with the official Photino samples, my personal Photino-based project, and the VRChat Creator Companion, which is also built with Photino.

I'm filing this issue in the .NET project because that's where I've encountered it, but it's entirely possible it's a deeper Photino Native issue.

I'm testing on Windows 10, I'm happy to share additional system details and logs as needed.

@cubedparadox
Copy link
Author

Additional Information:
I am able to run two instances of the same Photino app, just not two different Photino apps.
image

@mksondej
Copy link

mksondej commented Jun 6, 2024

(note: not a dev of this project)

Could not reproduce this in my simple tests (built same demo app twice but with different content and it worked fine) but if you feel that the port is the issue (which is possible) then this is the part that fails here on your environment:

https://github.com/tryphotino/photino.NET.Server/blob/0a545a0c07aaa1c1fb258c91163605fdf3bfc93d/Photino.NET.Server/PhotinoServer.NET.cs#L57

As a workaround and additional test you could swap the invocation of "CreateStaticFileServer" in your project to the variant that accepts the port parameter.
In other words change this in your Program.cs:

        PhotinoServer
            .CreateStaticFileServer(args, out string baseUrl)
            .RunAsync();

to this:

        PhotinoServer
            .CreateStaticFileServer(args, 9000, 100, "wwwroot", out baseUrl)
            .RunAsync();

If that works your guess was right and we can dig further why that "first available port checking" logic fails on your end.

PS: Looking at that if (port > port + portRange) and that entire condition in the while loop someone must've had been in a hurry :)

PS2: Note that this PhotinoServer is completely optional and all it does is spin up a localhost asp.net web app to serve your static files from wwwroot. Take a look at the code, it doesn't even add any custom middlewares. In my own project I've completely replaced that part with my own asp.net app since I also wanted to have some http endpoints and stuff.

@philippjbauer
Copy link
Member

@mksondej Thank you for the reply on this issue. @cubedparadox did this resolve your issue? We couldn't reproduce the issue either.

@philippjbauer
Copy link
Member

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants