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

(JP) textタイプのカラムにNULL値を含むテーブルの検索でSIGSEGV #20

Closed
taiki-k opened this issue May 23, 2014 · 3 comments
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected

Comments

@taiki-k
Copy link
Contributor

taiki-k commented May 23, 2014

textタイプのカラムにNULL値を含むテーブルを検索したところ、Segmentation Faultが発生しました。

  • バックトレース
#0  0x00007f593f8f972d in do_insert_tuple (tc_head=0x7f5937682018, tc_node=0x7f5937682278, tuple=0x254ec98) at tcache.c:2003
#1  0x00007f593f8fa454 in tcache_insert_tuple (tc_head=0x7f5937682018, tc_node=0x7f5937682278, tuple=0x254ec98) at tcache.c:2090
#2  0x00007f593f8fa76a in tcache_build_main (tc_scan=0x2562188) at tcache.c:2170
#3  0x00007f593f8fac34 in tcache_scan_next (tc_scan=0x2562188) at tcache.c:2302
#4  0x00007f593f90262b in pgstrom_load_gpuscan (gss=0x2560e98) at gpuscan.c:874
#5  0x00007f593f90363e in gpuscan_fetch_tuple (node=0x2560e98) at gpuscan.c:1175
#6  0x00007f593f903c80 in gpuscan_exec (node=0x2560e98) at gpuscan.c:1331
#7  0x00000000006807e7 in ExecCustomPlan (cpstate=0x2560e98) at nodeCustom.c:37
#8  0x00000000006684b5 in ExecProcNode (node=0x2560e98) at execProcnode.c:453
#9  0x000000000067dab4 in agg_retrieve_direct (aggstate=0x2560700) at nodeAgg.c:1164
#10 0x000000000067d9cb in ExecAgg (node=0x2560700) at nodeAgg.c:1117
#11 0x0000000000668548 in ExecProcNode (node=0x2560700) at execProcnode.c:487
#12 0x0000000000665efe in ExecutePlan (estate=0x25605e8, planstate=0x2560700, operation=CMD_SELECT, sendTuples=1 '\001',
    numberTuples=0, direction=ForwardScanDirection, dest=0x24c8590) at execMain.c:1475
#13 0x0000000000663da8 in standard_ExecutorRun (queryDesc=0x2553d18, direction=ForwardScanDirection, count=0) at execMain.c:308
#14 0x0000000000663beb in ExecutorRun (queryDesc=0x2553d18, direction=ForwardScanDirection, count=0) at execMain.c:256
#15 0x00000000007f964e in PortalRunSelect (portal=0x25781b8, forward=1 '\001', count=0, dest=0x24c8590) at pquery.c:946
#16 0x00000000007f9275 in PortalRun (portal=0x25781b8, count=9223372036854775807, isTopLevel=1 '\001', dest=0x24c8590,
    altdest=0x24c8590, completionTag=0x7fffb2d12eb0 "") at pquery.c:790
#17 0x00000000007f29e2 in exec_simple_query (query_string=0x2510778 "select count(*) from text_test_null where str like 'A%';")
    at postgres.c:1045
#18 0x00000000007f7162 in PostgresMain (argc=1, argv=0x24a45c8, dbname=0x24a4428 "pgstrom_test", username=0x24a4408 "tkondo")
    at postgres.c:4004
#19 0x000000000076e18a in BackendRun (port=0x24cc2f0) at postmaster.c:4104
#20 0x000000000076d840 in BackendStartup (port=0x24cc2f0) at postmaster.c:3778
#21 0x0000000000769bfe in ServerLoop () at postmaster.c:1569
#22 0x0000000000769251 in PostmasterMain (argc=1, argv=0x24a33c0) at postmaster.c:1222
#23 0x00000000006b8aee in main (argc=1, argv=0x24a33c0) at main.c:223
  • 対象のテーブル
pgstrom_test=# \d text_test_null
 Table "public.text_test_null"
 Column |   Type   | Modifiers
--------+----------+-----------
 id     | integer  |
 len    | smallint |
 str    | text     |
  • 実行したSQL
select count(*) from text_test_null where str like 'A%';
@kaigai
Copy link
Contributor

kaigai commented May 23, 2014

do_insert_tuple() 関数で、NULLフィールドのテストをしていませんでした。
最新版で修正しています。

なお、like関数はPG-Stromで実装されていませんので、キャッシュ上を
スキャンしてCPUで処理を行います…。

@taiki-k
Copy link
Contributor Author

taiki-k commented May 23, 2014

最新版で再現確認したところ、別の場所でSEGVしました。

  • バックトレース
#0  0x0000003cdbc89cf8 in memcpy () from /lib64/libc.so.6
#1  0x00007fbb93d108cc in tcache_copy_cs_varlena (tcs_dst=0x7fbb83bd8018, base_dst=0, tcs_src=0x7fbb89bd8018, base_src=262017,
    attidx=0, nitems=127) at tcache.c:1189
#2  0x00007fbb93d120e3 in tcache_split_tcnode (tc_head=0x7fbb8ba9c018, tc_node_old=0x7fbb8ba9c318) at tcache.c:1631
#3  0x00007fbb93d1466b in tcache_insert_tuple (tc_head=0x7fbb8ba9c018, tc_node=0x7fbb8ba9c318, tuple=0x2934dd8) at tcache.c:2142
#4  0x00007fbb93d145db in tcache_insert_tuple (tc_head=0x7fbb8ba9c018, tc_node=0x7fbb8ba9c2c8, tuple=0x2934dd8) at tcache.c:2126
#5  0x00007fbb93d14775 in tcache_build_main (tc_scan=0x29267f8) at tcache.c:2173
#6  0x00007fbb93d14c3f in tcache_scan_next (tc_scan=0x29267f8) at tcache.c:2305
#7  0x00007fbb93d1c65c in pgstrom_load_gpuscan (gss=0x2925528) at gpuscan.c:880
#8  0x00007fbb93d1d66f in gpuscan_fetch_tuple (node=0x2925528) at gpuscan.c:1181
#9  0x00007fbb93d1dcb1 in gpuscan_exec (node=0x2925528) at gpuscan.c:1337
#10 0x00000000006807e7 in ExecCustomPlan (cpstate=0x2925528) at nodeCustom.c:37
#11 0x00000000006684b5 in ExecProcNode (node=0x2925528) at execProcnode.c:453
#12 0x000000000067dab4 in agg_retrieve_direct (aggstate=0x2924d90) at nodeAgg.c:1164
#13 0x000000000067d9cb in ExecAgg (node=0x2924d90) at nodeAgg.c:1117
#14 0x0000000000668548 in ExecProcNode (node=0x2924d90) at execProcnode.c:487
#15 0x0000000000665efe in ExecutePlan (estate=0x2924c78, planstate=0x2924d90, operation=CMD_SELECT, sendTuples=1 '\001',
    numberTuples=0, direction=ForwardScanDirection, dest=0x288cb80) at execMain.c:1475
#16 0x0000000000663da8 in standard_ExecutorRun (queryDesc=0x2898d08, direction=ForwardScanDirection, count=0) at execMain.c:308
#17 0x0000000000663beb in ExecutorRun (queryDesc=0x2898d08, direction=ForwardScanDirection, count=0) at execMain.c:256
#18 0x00000000007f964e in PortalRunSelect (portal=0x2922c68, forward=1 '\001', count=0, dest=0x288cb80) at pquery.c:946
#19 0x00000000007f9275 in PortalRun (portal=0x2922c68, count=9223372036854775807, isTopLevel=1 '\001', dest=0x288cb80,
    altdest=0x288cb80, completionTag=0x7fff8679fc20 "") at pquery.c:790
#20 0x00000000007f29e2 in exec_simple_query (query_string=0x28de778 "select count(*) from text_test_null where str like 'A%';")
    at postgres.c:1045
#21 0x00000000007f7162 in PostgresMain (argc=1, argv=0x28725c8, dbname=0x2872428 "pgstrom_test", username=0x2872408 "tkondo")
    at postgres.c:4004
#22 0x000000000076e18a in BackendRun (port=0x289a2f0) at postmaster.c:4104
#23 0x000000000076d840 in BackendStartup (port=0x289a2f0) at postmaster.c:3778
#24 0x0000000000769bfe in ServerLoop () at postmaster.c:1569
#25 0x0000000000769251 in PostmasterMain (argc=1, argv=0x28713c0) at postmaster.c:1222
#26 0x00000000006b8aee in main (argc=1, argv=0x28713c0) at main.c:223

@taiki-k
Copy link
Contributor Author

taiki-k commented May 23, 2014

最新版で再現確認し、再現しないことを確認しました。
修正されたと判断します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected
Projects
None yet
Development

No branches or pull requests

2 participants