Comments (4)
This is happening because:
- The version of rustc used by
cargo-pgx
and loaded extensions must match. - No matter what version of Rust you try to use with plrust, we'll (at the moment) actually be using 1.61 to do builds.
While most violation 1 should be caught by pgcentralfoundation/pgrx#873 in the future, I believe that plrust's implementation of 2 means that this is not the case.
In the short term, we should add detection of version mismatches into plrust as well. Although I would definitely like to remove this limitation in the future.
Thanks for the report, this was really subtle and useful to track down.
from plrust.
Just to follow up a little more from @thomcc's reply, here's a version of that Dockerfile that works:
FROM docker.io/library/postgres:15
RUN apt update
RUN apt -y install postgresql-server-dev-15 git curl build-essential pkg-config
RUN chmod a+rwx `$(which pg_config) --pkglibdir` \
`$(which pg_config) --sharedir`/extension \
/var/run/postgresql/
USER postgres
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- --default-toolchain=1.61.0 -y
ENV PATH="/var/lib/postgresql/.cargo/bin:${PATH}"
RUN cargo install cargo-pgx --version 0.6.0-alpha.1 --locked
RUN cargo pgx init --pg15 /usr/bin/pg_config
WORKDIR /var/lib/postgresql
RUN git clone https://github.com/tcdi/plrust.git
RUN cd plrust && git checkout 2831168a8a2be5e3f955b3b1ed39e7699f620aa2
RUN cd plrust && cargo pgx package
Essentially cargo-pgx
needs to be built with 1.61 before plrust can be built, and within the context of a Docker container we can force a default toolchain to be installed at rustup
time.
from plrust.
Thanks for the report!
I too was able to replicate this, but I was able to produce this core dump backtrace when running cargo pgx install --test --pg-config /usr/bin/pg_config --features pg_test
* thread #1, name = 'cargo-pgx', stop reason = signal SIGSEGV
* frame #0: 0x00007f1fc34d1af6 libc.so.6`__memmove_evex_unaligned_erms at memmove-vec-unaligned-erms.S:336
frame #1: 0x000055891729bb68 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] core::intrinsics::copy_nonoverlapping::hf2c4f49dd375e9df at intrinsics.rs:2333:9
frame #2: 0x000055891729bb59 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] core::ptr::const_ptr::_$LT$impl$u20$$BP$const$u20$T$GT$::copy_to_nonoverlapping::hb337c27b3cb0b153 at const_ptr.rs:1262
frame #3: 0x000055891729bb59 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] _$LT$T$u20$as$u20$alloc..slice..hack..ConvertVec$GT$::to_vec::h7d89f9939a395335 at slice.rs:164
frame #4: 0x000055891729bb23 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] alloc::slice::hack::to_vec::hc1d247618dbc943e at slice.rs:108
frame #5: 0x000055891729bb23 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] alloc::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::to_vec_in::hb79dc1a27a5e464a at slice.rs:438
frame #6: 0x000055891729bb23 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 [inlined] _$LT$alloc..vec..Vec$LT$T$C$A$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h475fa1fa71acef81 at mod.rs:2580
frame #7: 0x000055891729bb23 cargo-pgx`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h40854ad92b608644 at string.rs:1966
frame #8: 0x0000558916d1ca0c cargo-pgx`pgx_utils::sql_entity_graph::pgx_sql::PgxSql::build::h630424d5c7605e61 + 3180
frame #9: 0x0000558916d405ac cargo-pgx`cargo_pgx::command::schema::generate_schema::hec8ce224aacf4215 + 13164
frame #10: 0x0000558916cd48fc cargo-pgx`cargo_pgx::command::install::copy_sql_files::h227a2224a25a45fb + 332
frame #11: 0x0000558916cdf6bf cargo-pgx`cargo_pgx::command::install::install_extension::hb519860744a0204b + 4767
frame #12: 0x0000558916cdca89 cargo-pgx`_$LT$cargo_pgx..command..install..Install$u20$as$u20$cargo_pgx..CommandExecute$GT$::execute::h936c598ee458ba74 + 2329
frame #13: 0x0000558916dbf747 cargo-pgx`_$LT$cargo_pgx..command..pgx..Pgx$u20$as$u20$cargo_pgx..CommandExecute$GT$::execute::h761f794b5a69cdf0 + 1351
frame #14: 0x0000558916dd47ad cargo-pgx`cargo_pgx::main::h78c5d46ae19f6aa8 + 3261
frame #15: 0x0000558916d91053 cargo-pgx`std::sys_common::backtrace::__rust_begin_short_backtrace::h0f673620793c3bdb + 3
frame #16: 0x0000558916dc7a01 cargo-pgx`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h753d8132970775cd + 17
frame #17: 0x000055891726dc8f cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::hb69be6e0857c6cfb at function.rs:283:13
frame #18: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panicking::try::do_call::h396dfc441ee9c786 at panicking.rs:492
frame #19: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panicking::try::h6cdda972d28b3a4f at panicking.rs:456
frame #20: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panic::catch_unwind::h376039ec264e8ef9 at panic.rs:137
frame #21: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::hc94720ca3d4cb727 at rt.rs:148
frame #22: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panicking::try::do_call::h2422fb95933fa2d5 at panicking.rs:492
frame #23: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panicking::try::h488286b5ec8333ff at panicking.rs:456
frame #24: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 [inlined] std::panic::catch_unwind::h81636549836d2a25 at panic.rs:137
frame #25: 0x000055891726dc8c cargo-pgx`std::rt::lang_start_internal::h6ba1bb743c1e9df9 at rt.rs:148
frame #26: 0x0000558916dd9618 cargo-pgx`main + 40
frame #27: 0x00007f1fc3385d0a libc.so.6`__libc_start_main(main=(cargo-pgx`main), argc=8, argv=0x00007ffd29498fd8, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007ffd29498fc8) at libc-start.c:308:16
frame #28: 0x0000558916c1139a cargo-pgx`_start + 42
EDIT: Should be noted that this was ran in Docker on an x86_64 machine using the same Dockerfile as the example, but the differences were that I left out the last line in the Dockerfile so that I could docker run
into it and collect a core dump, and installing gdb
and lldb
so that I could inspect the core dump.
from plrust.
Thanks @thomcc and thanks for the workaround @BradyBonnette 👍
from plrust.
Related Issues (20)
- Call a function from another function HOT 6
- Add a function to list all the allowlisted crates with their respective versions, features HOT 2
- Plrustc will not compile on alpine/postgres. HOT 3
- Compiling multiple functions together HOT 7
- fix `plrust/build` to dynamically determine pgrx version HOT 1
- Some examples appear to always ERROR HOT 4
- Support for custom (opaque) type HOT 5
- plrustc does not seem to catch `include!` macro properly HOT 3
- env/option_env failing to be linted by plrustc HOT 7
- Accessing JsonbContainer HOT 12
- UDF load time is high when compared to PL/PGSQL HOT 2
- How to return an array of any dimenion from pl/rust function.
- Enhancement to prevent cargo from recompiling allowlisted dependencies. HOT 7
- plrust installation fails when postgres 15 compiled with gprof profiler HOT 2
- Publish to https://database.dev/ HOT 9
- enumerated type as function arg? HOT 7
- JSonb extract slower in Pl/Rust than in Pl/PgSql HOT 3
- Postgres Triggers, achieve different behaviour on INSERT, UPDATE, etc.
- Problem with clap v4.5.4 HOT 5
- seg faults when working with composite types HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plrust.