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

Silent deserialization exceptions #2194

Open
linyinfeng opened this issue Dec 17, 2023 · 0 comments
Open

Silent deserialization exceptions #2194

linyinfeng opened this issue Dec 17, 2023 · 0 comments

Comments

@linyinfeng
Copy link

Many deserialization exceptions are not reported to the user. These exceptions are all silently caught by catch (...) {}.

This makes troubleshooting much harder.

I follow https://docs.zerotier.com/roots/ to configure my own moon. But my moon file does not work; zerotier-cli listmoons shows nothing. I tried zerotier compiled with ZT_DEBUG=1, but no message related to moons printed. Then I read the code and tried to insert some fprintf, and it turns out that the method deserialize of World failed, throwing a ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW, which is silently ignored.

try {
World w;
w.deserialize(Buffer<ZT_WORLD_MAX_SERIALIZED_LENGTH>(tmp,(unsigned int)n));
if ((w.type() == World::TYPE_MOON)&&(w.id() == id)) {
addWorld(tPtr,w,true);
return;
}
} catch ( ... ) {}

After reading the code of the method, I finally figured out that the problem lies in the following code. I fixed my configuration by increasing the ZT_WORLD_MAX_ROOTS to a bigger number. The process of troubleshooting is not user-friendly.

ZeroTierOne/node/World.hpp

Lines 228 to 230 in 663ed73

if (numRoots > ZT_WORLD_MAX_ROOTS) {
throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant