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

[YSQL] [Stored Procedures] Segmentation fault on use of CURSOR #1681

Closed
d-uspenskiy opened this issue Jul 2, 2019 · 2 comments
Closed

[YSQL] [Stored Procedures] Segmentation fault on use of CURSOR #1681

d-uspenskiy opened this issue Jul 2, 2019 · 2 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug

Comments

@d-uspenskiy
Copy link
Contributor

The following sequence of command causes Segmentation fault in postgres process

postgres=# create table rc_test (a int, b int);

postgres=# create function return_unnamed_refcursor() returns refcursor as $$
postgres$# declare
postgres$#     rc refcursor;
postgres$# begin
postgres$#     open rc for select a from rc_test;
postgres$#     return rc;
postgres$# end
postgres$# $$ language plpgsql;

postgres=# select return_unnamed_refcursor();
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> 

Also FETCH NEXT FROM <CURSOR> statement is not supported

@d-uspenskiy d-uspenskiy assigned d-uspenskiy and mbautin and unassigned d-uspenskiy Jul 2, 2019
@d-uspenskiy d-uspenskiy added area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug labels Jul 2, 2019
@d-uspenskiy d-uspenskiy changed the title [YSQL] Segmentation fault on use CURSOR [YSQL] Segmentation fault on use of CURSOR Jul 2, 2019
@kmuthukk
Copy link
Collaborator

kmuthukk commented Jul 2, 2019

Stack trace associated with core:

(gdb) where
#0  InstrEndLoop (instr=0x0) at ../../../../../../src/postgres/src/backend/executor/instrument.c:119
#1  0x00007fb64a3393af in ybpgm_ExecutorEnd (queryDesc=0x37ee370) at ../../../../../src/postgres/contrib/yb_pg_metrics/yb_pg_metrics.c:445
#2  0x000000000060c36c in PortalCleanup (portal=<optimized out>) at ../../../../../../src/postgres/src/backend/commands/portalcmds.c:300
#3  0x0000000000961b42 in PortalDrop (portal=0x34151f0, isTopCommit=<optimized out>) at ../../../../../../../src/postgres/src/backend/utils/mmgr/portalmem.c:499
#4  0x0000000000962070 in PreCommit_Portals (isPrepare=isPrepare@entry=false) at ../../../../../../../src/postgres/src/backend/utils/mmgr/portalmem.c:747
#5  0x000000000051c60c in CommitTransaction () at ../../../../../../../src/postgres/src/backend/access/transam/xact.c:2025
#6  0x000000000051cca5 in YBCCommitTransactionAndUpdateBlockState () at ../../../../../../../src/postgres/src/backend/access/transam/xact.c:2837
#7  0x00000000007de03d in finish_xact_command () at ../../../../../../src/postgres/src/backend/tcop/postgres.c:2528
#8  exec_simple_query (query_string=0x33a4190 "select return_unnamed_refcursor();") at ../../../../../../src/postgres/src/backend/tcop/postgres.c:1174
#9  0x00000000007df1ac in PostgresMain (argc=<optimized out>, argv=argv@entry=0x33db718, dbname=0x33db5f8 "postgres", username=0x33db5d8 "postgres")
    at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4373
#10 0x00000000004927ad in BackendRun (port=0x33d1c20) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4398
#11 BackendStartup (port=0x33d1c20) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4064
#12 ServerLoop () at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1724
#13 0x0000000000759a68 in PostmasterMain (argc=argc@entry=19, argv=argv@entry=0x33c4330) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1387
#14 0x00000000006b229a in PostgresServerProcessMain (argc=19, argv=0x33c4330) at ../../../../../../src/postgres/src/backend/main/main.c:234
#15 0x00000000006b2499 in main ()

@kmuthukk kmuthukk changed the title [YSQL] Segmentation fault on use of CURSOR [YSQL] [Stored Procedures] Segmentation fault on use of CURSOR Jul 2, 2019
@m-iancu m-iancu added this to YQL-beta Dec 7, 2021
@m-iancu
Copy link
Contributor

m-iancu commented Mar 14, 2022

Works in latest probably fixed as part of #2005.

@m-iancu m-iancu closed this as completed Mar 14, 2022
@m-iancu m-iancu moved this to Done in YQL-beta Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug
Projects
Status: Done
Development

No branches or pull requests

4 participants