-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug] sslocal
cannot daemonize when a plugin is specified via config file
#640
Comments
Couldn't reproduce with 1.12.0-alpha.8 and What did you see in logs when daemonizing |
Previously I had tried two plugins. I just tried using v2ray a moment ago and daemonizing also failed. This is on v1.11.2. When daemonizing
Things I tried/checked
An interesting observation: when daemonizing as non-root with or without a plugin, the pid file is created but is left empty. There shouldn't be a problem with file permissions as all this is happening in my home directory. Not sure how this may be related to this issue but FYI. I will try the latest git version and report back if you so desire. |
Also can you please share your working config file? Just to rule out the possibility of some unknown config conflicts. |
I used the least working configuration with only required fields. |
Would you consider this a minimal config? {
"servers": [
{
"address": "foo.bar",
"port": 8800,
"password": "foobar",
"method": "chacha20-ietf-poly1305",
"plugin": "./v2ray",
"plugin_opts": "tls;host=foo.bar"
}
],
"local_port": 1080
} I ran |
I just tried with the latest git version ( Trying to increase the verbosity level with |
机器的内存多大? |
$ free -h
total used free shared buff/cache available
Mem: 31Gi 5.8Gi 8.8Gi 2.5Gi 16Gi 22Gi
Swap: 31Gi 0B 31Gi |
如果要读取当前目录,难免歧义,显式指定 |
@dev4u Thank you for the tips but I am more than proficient in using Bash shell, and I know for a fact that my files are referenced correctly. What you said applies only in the case of executable binary lookup - for example when running
If you read my earlier posts you would see that the only variable changed was whether |
Also, when |
I can reproduce with this config. You can find the reason by running
Errno 1 is So setting |
You may have to use absolute path to plugin, or let process to find |
Okay, it seems like I have actually discovered two closely related but different issues here. The first one is exactly as you stated: if The second one is the same problem but with Commit 862a8a7 did fix the first issue, but not the second one. I assume you reverted the change due to backward compatibility concerns? I think the greater problem here is the difference in behavior between "daemon mode" and "non-daemon mode". The same config file can work in one mode but fail in another, which is unexpected and hard to diagnose. |
Nope. It didn't fix the first issue at all. You could try to apply that commit locally and see if that fixes your issue? |
Weird, I just compiled and tested at 862a8a7 again and indeed it didn't fix anything. I must have tested with the wrong config file last time. As far as I understand, use std::{env::current_dir, path::Path};
let pwd = current_dir()
.expect("bad pwd")
.canonicalize()
.expect("cannot canonicalize");
let mut d = Daemonize::new().umask(0).working_directory(pwd); Excuse my bad error handling Also I believe it is correct not to call |
Did you tried adding |
Yes it did. Just tested with Would you like a PR? |
Go ahead. |
This is the default behavior when not daemonizing.
By the way, you may wish to include a compatibility note on this in the next release, as I am concerned that this "fix" could break some people's configs. In the original implementation, since Admittedly, a path like this would be considered an "erroneous" config. Nevertheless this change breaks bug-compatibility so I think it's worth a mention. |
Bug description
sslocal
cannot daemonize using the-d
or--daemonize
flag when the config file specifies a plugin.I am not entirely sure that this is 100% the real issue here, but I have tested on two different OSes (RHEL8 & Arch) and observed the same behavior, so let's just say I am reasonably confident.
To replicate
Here I will use simple-tls as an example, but the choice of plugin seems irrelevant.
On a Linux x64 machine:
-d
is not used,sslocal
runs correctly-d
is used without a plugin,sslocal
daemonizes correctly-d
is used with a plugin,sslocal
no longer daemonizesEnvironment & versions
The text was updated successfully, but these errors were encountered: