You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Random crashes in System.Net.Mail test suites with mono interpreter #87271
The way this issue reproduces is that when doing a call ip is fetched as null from cmethod->code. This pointed to the idea that there is incorrect memory synchronisation between imethod->transformed and imethod->code.
Adding a read barrier in the fast path for each call might be quite expensive. It might be worthwhile benchmarking though.
Another possible fix would be to rely on data dependency to ensure data is accessed correctly. We could extract imethod compilation data in a separate structure that is published in the imethod when compilation is done and then, during method execution, access this through it: imethod->transform_data->code, imethod->transform_data->alloca_size etc. This would add a few ptr derefs in the fast path so it probably would have some penalty cost, I assume lower than a read barrier for every call.
Another fix that would add no overhead for calls, would be to reuse the existing idea used for tiering and patch with new imethods. We would have a separate InterpMethod for compiled method and when we compile it, we patch the data items with the new pointer, relying once again on data dependency to ensure the compilation data is accessed correctly.
The same logical problem still remains, that if the method is transformed we expect certain fields to have been properly initialized. We could check for code and maybe this particular issue is fixed, but then immediately during execution imethod->alloca_size, imethod->data_items etc. could also theoretically be invalid.
Activity
vargaz commentedon Jun 8, 2023
@BrzVlad
BrzVlad commentedon Jun 8, 2023
BrzVlad commentedon Jun 8, 2023
Looks like
pthread_exitcrashes ? Doesn't make much sensevargaz commentedon Jun 8, 2023
I get random crashes inside the interpreter locally:
BrzVlad commentedon Jun 9, 2023
The way this issue reproduces is that when doing a call
ipis fetched as null fromcmethod->code. This pointed to the idea that there is incorrect memory synchronisation betweenimethod->transformedandimethod->code.The following fix solves the issue:
Adding a read barrier in the fast path for each call might be quite expensive. It might be worthwhile benchmarking though.
Another possible fix would be to rely on data dependency to ensure data is accessed correctly. We could extract imethod compilation data in a separate structure that is published in the imethod when compilation is done and then, during method execution, access this through it:
imethod->transform_data->code,imethod->transform_data->alloca_sizeetc. This would add a few ptr derefs in the fast path so it probably would have some penalty cost, I assume lower than a read barrier for every call.Another fix that would add no overhead for calls, would be to reuse the existing idea used for tiering and patch with new imethods. We would have a separate
InterpMethodfor compiled method and when we compile it, we patch the data items with the new pointer, relying once again on data dependency to ensure the compilation data is accessed correctly.vargaz commentedon Jun 9, 2023
Wouldn't getting rid of
transformedand checkingcodeinstead solve the issue ?BrzVlad commentedon Jun 9, 2023
The same logical problem still remains, that if the method is transformed we expect certain fields to have been properly initialized. We could check for
codeand maybe this particular issue is fixed, but then immediately during executionimethod->alloca_size,imethod->data_itemsetc. could also theoretically be invalid.