exo icon indicating copy to clipboard operation
exo copied to clipboard

Need better handler for tmp files to unblock running under different users

Open FFAMax opened this issue 1 year ago • 4 comments

https://github.com/exo-explore/exo/blob/bc1d88d86d6a016669974d7d3dbf87fc07b18bc7/exo/helpers.py#L38

If user A used exo, user B will unable to use exo due tmp file blocked by user A until manually removed or system reloaded (in cases tmp folder wiped during reload)

FFAMax avatar Oct 28 '24 08:10 FFAMax

I'm not sure what you mean by this.

AlexCheema avatar Oct 29 '24 20:10 AlexCheema

exo_used_ports

In tmp dir will be created file exo_used_ports. Once another user wanna use exo, file is there and cause user can't use

FFAMax avatar Oct 30 '24 05:10 FFAMax

@AlexCheema some further discussion of this in https://github.com/exo-explore/exo/pull/396. On a linux machine, let's say User 1 creates a file in /tmp folder to store ports. Now User 2 comes along and tries to read/write to the same file, but gets an error, since the file is only modifiable by user 1.

I think the solution here might be to just simplify the find_available_port function. I'm not 100% sure what the thinking is behind persisting the recently used ports, instead of just poking around and trying to find a random port that's available in the given range (which should be fairly trivial... i'd assume in the vast majority of cases, if you randomly select in the given range (49152 to 65535) it will find an available port on the first or second try. Is the issue that you might collide with a port used by another machine in the network?

dtnewman avatar Nov 03 '24 19:11 dtnewman

Is the issue that you might collide with a port used by another machine in the network?

I don't think it may interfere with another machine on the network because machines may have the same ports while they are sitting on different addresses.

available_ports = set(range(min_port, max_port + 1)) - set(used_ports) Probably it was used to reduce iterations when looking for another port to open a new socket.

I don't see the issue if just try to bind next available port regardless of what written in the file. I see only one call of this function in main.py if args.node_port is None: args.node_port = find_available_port(args.node_host)

Also can introduce and stick to default port, fallback to random if default already used.

FFAMax avatar Nov 03 '24 21:11 FFAMax

Should be fixed in 1.0

Evanev7 avatar Dec 18 '25 20:12 Evanev7