-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use fixed-length paths in memifproxy #285
Comments
Solution2 looks good to me. @edwarnicke Can you also have a look at the issue and share your thoughts? |
Which is state we will lose when we heal :(
You are correct about the issues for this within NSM. However, VPP's api runs in a single worker thread. It may very well be doable to upstream code to VPP that does the relative path trick. |
In the immediate term: why are we ever setting the connection id manually in any of our things like cmd-nsc ? |
Basically, memif chain element is using in next places
Let's consider death cases:
it seems solution 2 can be used. Did I miss something? UPD: we also could store the map connId to sockerDir on the disk. |
In the immediate term: why are we ever setting the connection id manually in any of our things like cmd-nsc ? |
Note: we are setting id manually because we want to not see issues on NSC restarting. And it is not manually, we are using the unique name of Pod. |
@denis-tingaikin What issues would we see on NSC restarting if we didn't manually set its connection ID? |
|
Can't reproduce the problem. MemifProxy client has been deleted in this #470. MemifProxy server doesn't have this problem. |
In memifproxy we create unix sockets with path containing connection id.
sdk-vpp/pkg/networkservice/mechanisms/memif/memifproxy/client.go
Lines 82 to 84 in 7780191
This is an easy way to ensure that every connection has its own unique socket, but it has drawbacks.
Unix sockets are limited in length. On linux the limit is 108.
Connection IDs are not limited in length, and paths that contain them can easily exceed this limit. Related issue: networkservicemesh/deployments-k8s#1826
To ensure reliable behavior we must not use any variable length strings when defining paths.
We have several possible solutions for this:
Solution 1
Use relative paths.
I don't think is an appropriate solution because in order to use relative path to a file in a certain directory we would need to change current working directory, and this is basically incompatible with multithreading.
Solution 2
Keep
[connection id -> uuid]
map in memifproxy, and use these uuids for socket paths.Solution 3
Use short symlinks to sockets with potentially long paths.
This is basically identical to second solution, because we would still need to keep mapping from connection id to its symlink, so I believe it's overly complicated without any real benefits.
Conclusion
I think that the only suitable solution here is the second: use mapped uuids for socket paths.
It would also be pretty easy to implement.
There is still another unknown-length part of the path:
os.TempDir()
. Temp directory is usually just/tmp
by default, but it is not guaranteed. For example, it seems like on MacOS default temp dir is relatively long (48 symbols). And, of course, users can set temp dir to be whatever they want.We can probably say that very long temp dir path is just an invalid configuration for a program that uses memifproxy.
The text was updated successfully, but these errors were encountered: