-
Notifications
You must be signed in to change notification settings - Fork 387
gc_cdatanum is counted improperly #5820
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
Comments
Buristan
added a commit
to tarantool/luajit
that referenced
this issue
Feb 16, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Follows up tarantool/tarantool#5187 Closes tarantool/tarantool#5820
Buristan
added a commit
to tarantool/luajit
that referenced
this issue
Feb 16, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Relates to tarantool/tarantool#5820 Follows up tarantool/tarantool#5187
Buristan
added a commit
to tarantool/luajit
that referenced
this issue
Feb 16, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187
Buristan
added a commit
to tarantool/luajit
that referenced
this issue
Mar 4, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187 Reviewed-by: Igor Munkin <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]>
igormunkin
pushed a commit
to tarantool/luajit
that referenced
this issue
Mar 4, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187 Reviewed-by: Igor Munkin <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]> Signed-off-by: Igor Munkin <[email protected]> (cherry picked from commit 82932be)
igormunkin
pushed a commit
to tarantool/luajit
that referenced
this issue
Mar 4, 2021
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187 Reviewed-by: Igor Munkin <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]> Signed-off-by: Igor Munkin <[email protected]> (cherry picked from commit 82932be)
The issue is resolved in scope of tarantool/luajit@82932be. The submodule was updated in tarantool in 2.8.0-103-g3fe840b02 (3fe840b), 2.7.1-94-g755dfe2d5 (755dfe2), 2.6.2-91-g05ad06d14 (05ad06d). |
igormunkin
pushed a commit
to tarantool/luajit
that referenced
this issue
Jun 16, 2022
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187 Reviewed-by: Igor Munkin <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]> Signed-off-by: Igor Munkin <[email protected]>
igormunkin
pushed a commit
to tarantool/luajit
that referenced
this issue
Jun 16, 2022
When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not collected immediately, when lj_cdata_free() is called. Instead, it is resurrected and marked finalized, so it is collected at the next GC cycle. The reason of the bug is that gc_cdatanum is decremented when cdata is resurrected too (i.e. twice). This patch excludes cdata decrementing from resurrection branch and adds corresponding tests. Resolves tarantool/tarantool#5820 Follows up tarantool/tarantool#5187 Reviewed-by: Igor Munkin <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]> Signed-off-by: Igor Munkin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some kinds of cdata are counted improperly (i.e. are not counted).
How to reproduce:
Assume we have a file named <cdatanum.lua> with the following code:
Output:
The text was updated successfully, but these errors were encountered: