SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
18.51k stars 2.22k forks source link

unexpected EOF when updating binary rulesets #2105

Closed ilfat12 closed 3 days ago

ilfat12 commented 4 days ago

Operating system

Linux

System version

Linux 6.6

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

sing-box-1.10.0~beta.7-1.x86_64

Description

If I add large lists of rulesets, such as catagory-ads-all or ip countries, then unexpected EOF errors appear in the logs when updating binary rulesets. There are no problems in source format.

This error is probably due to the fact that sometimes a real IP is given instead of a fake IP. I have not noticed this with source format.

Reproduction

Run:

sing-box geosite export category-ads-all
sing-box rule-set compile geosite-category-ads-all.json

Add geosite-category-ads-all.srs as binary ruleset to the config file. Restart sing-box and watch its output. Run the following command again to have the file changed and the application reread the rulesets (thanks for this feature): sing-box rule-set compile geosite-category-ads-all.json

Logs

сен 13 15:46:55 server sing-box[621995]: ERROR[0026] router: reload rule-set block: unexpected EOF
сен 13 15:46:55 server sing-box[621995]: ERROR[0026] router: reload rule-set block: read rule[1]: LabelBitmap: unexpected EOF
сен 13 15:46:55 server sing-box[621995]: ERROR[0027] router: reload rule-set block: read rule[1]: Labels: unexpected EOF
сен 13 15:46:56 server sing-box[621995]: ERROR[0027] router: reload rule-set block: read rule[1]: Labels: unexpected EOF
сен 13 15:46:56 server sing-box[621995]: ERROR[0027] router: reload rule-set block: read rule[2]: LabelBitmap: unexpected EOF
сен 13 15:46:56 server sing-box[621995]: ERROR[0027] router: reload rule-set block: read rule[2]: LabelBitmap: unexpected EOF
сен 13 15:46:56 server sing-box[621995]: ERROR[0027] router: reload rule-set block: read rule[2]: Labels: unexpected EOF

Supporter

Integrity requirements

ilfat12 commented 4 days ago

This error is probably due to the fact that sometimes a real IP is given instead of a fake IP. I have not noticed this with source format.

Still, this problem is not related to the one described above. I will describe it in another bug

nekohasekai commented 4 days ago

Only files that are written continuously (like cp/mv) can be reloaded. In your use case, there will be long write pauses waiting for compilation, so this scenario is not supported.

ilfat12 commented 3 days ago

Now I understand why there are no errors when restarting the service. I will use mv. Thanks!

ilfat12 commented 3 days ago

Even with mv there was an error: ERROR[91140] router: reload rule-set block: EOF

Disabling COW on btrfs for the directory with these files solved the problem completely.