clash-rs icon indicating copy to clipboard operation
clash-rs copied to clipboard

Reloading config bug in clash-rs

Open xmh0511 opened this issue 3 months ago • 5 comments

https://github.com/libnyanpasu/clash-nyanpasu/issues/3536#issuecomment-3314291700

xmh0511 avatar Sep 22 '25 01:09 xmh0511

@xmh0511 do you have the error logs?

I think the outbound proxy groups and providers get reloaded at https://github.com/watfaq/clash-rs/blob/75ca7aab46e57a50c156ba93e89b39c7074ab272/clash-lib/src/lib.rs#L360

how does the error in GUI get reproduced?

ibigbug avatar Sep 24 '25 13:09 ibigbug

@xmh0511 do you have the error logs?

I think the outbound proxy groups and providers get reloaded at https://github.com/watfaq/clash-rs/blob/75ca7aab46e57a50c156ba93e89b39c7074ab272/clash-lib/src/lib.rs#L360

how does the error in GUI get reproduced?

clash-nyanpasu.2025-08-29.app.zip

This is the log file generated during the switching of different airports, with both the debug level of the log for the clash core and Nyanpasu

Image Image Image Image

xmh0511 avatar Sep 25 '25 01:09 xmh0511

@ibigbug Here’s what I noticed from the logs, hope this helps:

  • GeoIP failure
[clash-rs]: WARN clash-lib\src\app\router\rules\geoip.rs:30: GeoIP lookup failed: MMDB not available.

Seems to fall back to DIRECT. Maybe related to a missing MMDB file? A simple existence check could make this clearer.

  • Connection rejection
[clash-rs]: WARN clash-lib\src\app\dispatcher\dispatcher_impl.rs:201: failed to establish remote connection [TCP] 127.0.0.1:50419 -> cube.weixinbridge.com:443, error: "rejected"

Could be routing issues after the GeoIP failure. Extra debug logs in dispatcher_impl.rs might help confirm.

  • Frequent DNS init
[clash-rs]: INFO clash-lib\src\app\dns\dns_client.rs:304: initializing dns client

Saw repeated initialization, which might hurt performance. Maybe caching with Once could avoid repeated init.

  • Core termination
[clash-rs]: core terminated with status: TerminatedPayload { code: Some(1) }.

Possibly tied to the above issues. More detailed exit logs in core.rs could help diagnose.

Slinetrac avatar Sep 25 '25 05:09 Slinetrac

@ibigbug

how does the error in GUI get reproduced?

You should have at least two subscribed airports. Using the clash-rs core in Nyanpasu, and just switching from one airport to another, as shown in this picture

Image

xmh0511 avatar Sep 25 '25 05:09 xmh0511

I took a glance at current context. This Error message is not related, which is caused by a FetchError via fetching DELETE /connections endpoint.

  • The core has stopped, so the endpoint is down

The core terminated with status code 1, in Windows, it possible it is a proactive exit from clash-rs.

  • https://github.com/search?q=repo%3AWatfaq%2Fclash-rs%20exit&type=code

In this case,

Possbilely, we lost the eprintln! log from clash-rs.

Maybe we have closed the stdout/stderr logger too early before the stdio stream fullly closed.

greenhat616 avatar Sep 25 '25 08:09 greenhat616