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
Calling a Lua function from SQL changes the number of rows in the result! #5427
Comments
I looked at this reproducer and found another assert on debug. Decreased reproducer a bit:
Result:
I think after we fix this assert the issue also will be fixed. |
ImeevMA
added a commit
that referenced
this issue
Nov 2, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427
ImeevMA
added a commit
that referenced
this issue
Dec 16, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427
ImeevMA
added a commit
that referenced
this issue
Dec 22, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427
ImeevMA
added a commit
that referenced
this issue
Dec 23, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427
Korablev77
pushed a commit
that referenced
this issue
Dec 24, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427 (cherry picked from commit d0d668f)
Korablev77
pushed a commit
that referenced
this issue
Dec 24, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427 (cherry picked from commit d0d668f)
ligurio
pushed a commit
that referenced
this issue
Dec 25, 2020
Prior to this patch, region on fiber was reset during select(), get(), count(), max(), or min(). This would result in an error if one of these operations was used in a user-defined function in SQL. After this patch, these functions truncate region instead of resetting it. Closes #5427
Closed
Totktonada
pushed a commit
that referenced
this issue
Dec 28, 2020
A read only transaction should not invalidate the fiber region. The problem was found in context of calling a Lua function from SQL on tarantool 2.* (#5427). Another problem (#5623) was fixed by this commit on tarantool 2.*. Since 2.2.0-469-g707e58a3f ('box: rework box_lua_{call, eval} to use input port') arguments for a C stored procedure is allocated on a fiber region. The region is truncated at the end of the call. When the procedure performs a read only transaction, fiber_gc() may be called and so the region_truncate() call will fail on assertion (on Debug build). Despite that all found cases are specific for tarantoo 2.*, it is possible to be hit by the problem on 1.10 as well. It is enough to allocate something on a region (explicitly or implicitly) and perform any read only transaction. So it looks worthful to backport the fix to 1.10 as well. (cherry picked from commit d0d668f) The original commit message: | sql: do not reset region on select | | Prior to this patch, region on fiber was reset during select(), get(), | count(), max(), or min(). This would result in an error if one of these | operations was used in a user-defined function in SQL. After this patch, | these functions truncate region instead of resetting it. | | Closes #5427
Totktonada
pushed a commit
that referenced
this issue
Dec 29, 2020
A read only transaction should not invalidate the fiber region. The problem was found in context of calling a Lua function from SQL on tarantool 2.* (#5427). Another problem (#5623) was fixed by this commit on tarantool 2.*. Since 2.2.0-469-g707e58a3f ('box: rework box_lua_{call, eval} to use input port') arguments for a C stored procedure is allocated on a fiber region. The region is truncated at the end of the call. When the procedure performs a read only transaction, fiber_gc() may be called and so region_truncate() will fail on assertion (on Debug build). Despite that all found cases are specific for tarantool 2.*, it is possible to be hit by the problem on 1.10 as well. It is enough to allocate something on a region (explicitly or implicitly) and perform a read only transaction. So it looks worthful to backport the fix to 1.10 as well. (cherry picked from commit d0d668f) The original commit message: | sql: do not reset region on select | | Prior to this patch, region on fiber was reset during select(), get(), | count(), max(), or min(). This would result in an error if one of these | operations was used in a user-defined function in SQL. After this patch, | these functions truncate region instead of resetting it. | | Closes #5427
Totktonada
pushed a commit
that referenced
this issue
Dec 29, 2020
A read only transaction should not invalidate the fiber region. The problem was found in context of calling a Lua function from SQL on tarantool 2.* (#5427). Another problem (#5623) was fixed by this commit on tarantool 2.*. Since 2.2.0-469-g707e58a3f ('box: rework box_lua_{call, eval} to use input port') arguments for a C stored procedure is allocated on a fiber region. The region is truncated at the end of the call. When the procedure performs a read only transaction, fiber_gc() may be called and so region_truncate() will fail on assertion (on Debug build). Despite that all found cases are specific for tarantool 2.*, it is possible to be hit by the problem on 1.10 as well. It is enough to allocate something on a region (explicitly or implicitly) and perform a read only transaction. So it looks worthful to backport the fix to 1.10 as well. (cherry picked from commit d0d668f) The original commit message: | sql: do not reset region on select | | Prior to this patch, region on fiber was reset during select(), get(), | count(), max(), or min(). This would result in an error if one of these | operations was used in a user-defined function in SQL. After this patch, | these functions truncate region instead of resetting it. | | Closes #5427
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tarantool versions:
Tarantool Enterprise For Mac 2.3.1-154-g4616b51c4
Tarantool Enterprise 2.4.2-12-g11f587c
Tarantool 2.5.1-0-gc2d8c03ee
OS version:
Centos 8, Mac OS X
Bug description:
Calling a Lua function from SQL changes the number of rows in the result!
Steps to reproduce:
Run the following script (especially compare the first and the fourth queries):
And we get this error on the last line:
The text was updated successfully, but these errors were encountered: