GreptimeTeam / greptimedb

An open-source, cloud-native, distributed time-series database with PromQL/SQL/Python supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
3.96k stars 282 forks source link

error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused #4219

Open yurivict opened 1 week ago

yurivict commented 1 week ago

What type of bug is this?

Other

What subsystems are affected?

Standalone mode

Minimal reproduce step

regular build

What did you expect to see?

n/a

What did you see instead?

error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused
   --> /wrkdirs/usr/ports/databases/greptimedb/work/RustPython-9ed51374125b5f1a9e5cee5dd7e27023b8591f1e/vm/src/class.rs:124:17
    |
123 |                 let r: &Py<PyType> = &typ;
    |                                       --- backing allocation comes from here
124 |                 &*(r as *const _)
    |                 ^^^^^^^^^^^^^^^^^
    |
    = note: casting from `core::PyRef<type_::PyType>` (8 bytes) to `core::Py<type_::PyType>` (856 bytes)
    = note: `#[deny(invalid_reference_casting)]` on by default

warning: `rustpython-vm` (lib) generated 5 warnings
error: could not compile `rustpython-vm` (lib) due to 1 previous error; 5 warnings emitted

What operating system did you use?

FreeBSD 14.1

What version of GreptimeDB did you use?

0.8.2

Relevant log output and stack trace

Built with rust-nightly-1.80.0.20240507
tisonkun commented 1 week ago

I guess this is the similar to https://github.com/GreptimeTeam/greptimedb/issues/3656 that we have a old RustPython fork dependency .. but our CI should guard that if you use the same toolchain with the one we configure in rust-toolchain.toml, it should compile.

However, this can be a reason that we rework the Python scripting functions and totally get rid of this debt ..

yurivict commented 1 week ago

3656 was about the use of discontinued nightly features.