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

Manage all processes with GuardedProcessPool #1747

Merged
merged 1 commit into from Apr 12, 2018

Conversation

Mygod
Copy link
Contributor

@Mygod Mygod commented Apr 10, 2018

Type of changes

  • General refinement

Details

This way we can destroy the processes and wait for them to exit in parallel, and ensure the process is destroyed so that we won't encounter strange port being used issue at the same time.

This addresses #1740 but probably doesn't fix it.

This way we can destroy the processes and wait for them to exit in parallel, and ensure the process is destroyed so that we won't encounter strange port being used issue at the same time.
@Mygod Mygod requested a review from madeye April 10, 2018 04:57
@madeye
Copy link
Contributor

madeye commented Apr 10, 2018

I think we need sigkill after waitfor timeout. Otherwise, it may not fix #1740.

@Mygod
Copy link
Contributor Author

Mygod commented Apr 10, 2018

Process.waitFor requires API 26. And I'd also rather not use sigkill unless necessary. Could you investigate what would cause ss-local to ignore sigterm?

@madeye
Copy link
Contributor

madeye commented Apr 10, 2018

Actually, I cannot report the issue locally.

According to the report:

1。断开正常连接,切换到错误配置,连接报错,关闭连接。切换到正常配置,连接报错。
2,断开正常连接,切换到错误配置,连接报错,不关闭直接切换到正常配置,连接正常。

@Mygod
Copy link
Contributor Author

Mygod commented Apr 10, 2018

Yes. Me neither. But there does seem to be some edge cases where libss-local doesn't respond to SIGTERM. For example, in #1742 when the socket is accidentally not protected, or the new example I just posted at #1740.

@madeye
Copy link
Contributor

madeye commented Apr 10, 2018

After instrumenting ss-local, my observation is that the ss-local process hangs when stop_plugin(). It means it handles SIGTERM correctly, but the child process didn't.

ss-local calls cork_subprocess_group_abort then waitpid until the child process finished.

https://github.com/shadowsocks/libcork/blob/c9b3ea9638b3adcbc07ee229fd630f439cdecae8/src/libcork/posix/subprocess.c#L483

@Mygod
Copy link
Contributor Author

Mygod commented Apr 10, 2018

@madeye Okay. Here's the source code: shadowsocks/kcptun-android#32

@madeye madeye merged commit 89c5d94 into shadowsocks:master Apr 12, 2018
@Mygod Mygod deleted the guarded-process-pool branch April 13, 2018 20:37
FakeTrader pushed a commit to FakeTrader/shadowsocks-android that referenced this pull request Aug 21, 2018
Manage all processes with GuardedProcessPool
bannedbook pushed a commit to bannedbook/SpeedUp.VPN that referenced this pull request Dec 25, 2019
Manage all processes with GuardedProcessPool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants