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

[vm-service] Make sure socket IDs are unique in SocketProfile #49111

Open
alexmarkov opened this issue May 25, 2022 · 1 comment
Open

[vm-service] Make sure socket IDs are unique in SocketProfile #49111

alexmarkov opened this issue May 25, 2022 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. pkg-vm-service

Comments

@alexmarkov
Copy link
Contributor

SocketStatistic, which is a part of SocketProfile returned by getSocketProfile vm-service API describes socket id in the following way (https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service_extension.md#socketstatistic):

  // The unique ID associated with this socket.
  int id;

However, the implementation uses address of Socket C++ objects as those ids. Those objects can be freed and new Socket objects could be allocated at the same addresses, making those ids non-unique.

(This actually happens with new async/await implementation on service_2/network_profiling_test as async functions no longer capture everything in the context and socket objects can be garbage-collected earlier.)

@bkonyi

@alexmarkov alexmarkov added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. pkg-vm-service labels May 25, 2022
@alexmarkov
Copy link
Contributor Author

Note that network_profiling_test.dart now has a workaround for this bug:

// Workaround for dartbug.com/49111: make sure socket IDs are not reused.
sockets.add(serverSocket);
sockets.add(socket);
sockets.add(server);
sockets.add(client);

It can be removed when this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. pkg-vm-service
Projects
None yet
Development

No branches or pull requests

1 participant