Open
Description
The code in pgrx-examples/shmem has an issue. Possibly pg_shmem_init!() is missing something?
To duplicate the problem:
clone pgrx
cd pgrx-examples/shmem
cargo pgrx run
then:
shmem=# create extension shmem;
CREATE EXTENSION
shmem=# select hash_insert(42,42);
ERROR: PgLwLock is not initialized
DETAIL:
0: std::backtrace_rs::backtrace::libunwind::trace
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: std::backtrace::Backtrace::create
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/backtrace.rs:331:13
3: pgrx_pg_sys::submodules::panic::register_pg_guard_panic_hook::{{closure}}::{{closure}}
at /Users/ccleve/dev/pg/pgrx/pgrx-pg-sys/src/submodules/panic.rs:316:43
4: std::thread::local::LocalKey<T>::try_with
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/local.rs:283:12
5: std::thread::local::LocalKey<T>::with
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/local.rs:260:9
6: pgrx_pg_sys::submodules::panic::register_pg_guard_panic_hook::{{closure}}
at /Users/ccleve/dev/pg/pgrx/pgrx-pg-sys/src/submodules/panic.rs:313:13
7: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2077:9
8: std::panicking::rust_panic_with_hook
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:799:13
9: std::panicking::begin_panic_handler::{{closure}}
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:656:13
10: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:171:18
11: rust_begin_unwind
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
12: core::panicking::panic_fmt
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
13: pgrx::lwlock::PgLwLockInner<T>::exclusive
at /Users/ccleve/dev/pg/pgrx/pgrx/src/lwlock.rs:126:13
14: pgrx::lwlock::PgLwLock<T>::exclusive
at /Users/ccleve/dev/pg/pgrx/pgrx/src/lwlock.rs:77:18
15: shmem::hash_insert
at /Users/ccleve/dev/pg/pgrx/pgrx-examples/shmem/src/lib.rs:123:5
16: shmem::hash_insert_wrapper::_internal_wrapper::{{closure}}
at /Users/ccleve/dev/pg/pgrx/pgrx-examples/shmem/src/lib.rs:122:38
17: pgrx::memcxt::PgMemoryContexts::exec_in_context
at /Users/ccleve/dev/pg/pgrx/pgrx/src/memcxt.rs:590:22
18: pgrx::memcxt::PgMemoryContexts::switch_to
at /Users/ccleve/dev/pg/pgrx/pgrx/src/memcxt.rs:402:18
19: shmem::hash_insert_wrapper::_internal_wrapper
at /Users/ccleve/dev/pg/pgrx/pgrx-examples/shmem/src/lib.rs:122:38
20: shmem::hash_insert_wrapper::{{closure}}
at /Users/ccleve/dev/pg/pgrx/pgrx-examples/shmem/src/lib.rs:122:38
21: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
22: std::panicking::try::do_call
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
23: ___rust_try
24: std::panicking::try
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
25: std::panic::catch_unwind
at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
26: pgrx_pg_sys::submodules::panic::run_guarded
at /Users/ccleve/dev/pg/pgrx/pgrx-pg-sys/src/submodules/panic.rs:419:11
27: pgrx_pg_sys::submodules::panic::pgrx_extern_c_guard
at /Users/ccleve/dev/pg/pgrx/pgrx-pg-sys/src/submodules/panic.rs:395:20
28: hash_insert_wrapper
at /Users/ccleve/dev/pg/pgrx/pgrx-examples/shmem/src/lib.rs:122:38
29: ExecInterpExpr
at /Users/ccleve/.pgrx/13.16/src/backend/executor/execExprInterp.c:704:8
30: ExecEvalExprSwitchContext
at /Users/ccleve/.pgrx/13.16/src/backend/executor/../../../src/include/executor/executor.h:322:13
31: ExecProject
at /Users/ccleve/.pgrx/13.16/src/backend/executor/../../../src/include/executor/executor.h:356:9
32: ExecResult
at /Users/ccleve/.pgrx/13.16/src/backend/executor/nodeResult.c:136:10
33: ExecProcNode
at /Users/ccleve/.pgrx/13.16/src/backend/executor/../../../src/include/executor/executor.h:248:9
34: ExecutePlan
at /Users/ccleve/.pgrx/13.16/src/backend/executor/execMain.c:1632:10
35: standard_ExecutorRun
at /Users/ccleve/.pgrx/13.16/src/backend/executor/execMain.c:350:3
36: PortalRunSelect
at /Users/ccleve/.pgrx/13.16/src/backend/tcop/pquery.c:921:4
37: PortalRun
at /Users/ccleve/.pgrx/13.16/src/backend/tcop/pquery.c:765:18
38: exec_simple_query
at /Users/ccleve/.pgrx/13.16/src/backend/tcop/postgres.c:1241:10
39: PostgresMain
40: BackendRun
at /Users/ccleve/.pgrx/13.16/src/backend/postmaster/postmaster.c:4560:2
41: BackendStartup
at /Users/ccleve/.pgrx/13.16/src/backend/postmaster/postmaster.c:4244:3
42: ServerLoop
at /Users/ccleve/.pgrx/13.16/src/backend/postmaster/postmaster.c:1742:7
43: PostmasterMain
at /Users/ccleve/.pgrx/13.16/src/backend/postmaster/postmaster.c:1415:11
44: main
at /Users/ccleve/.pgrx/13.16/src/backend/main/main.c:210:3
Metadata
Assignees
Labels
No labels