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

RUST-1892 incorrect serialization/deserializer on big endian machines ( s390x ) #464

Closed
alexanderkjall opened this issue Mar 22, 2024 · 5 comments
Assignees
Labels
tracked-in-jira Ticket filed in Mongo's Jira system

Comments

@alexanderkjall
Copy link

Versions/Environment

  1. What version of Rust are you using?

rustc 1.72.0 (5680fa18f 2023-08-23)

  1. What operating system are you using?

Debian Sid

  1. What versions of the driver and its dependencies are you using? (Run
    cargo pkgid mongodb & cargo pkgid bson)

version 2.9.0 of bson

  1. What version of MongoDB are you using? (Check with the MongoDB shell using db.version())

not applicable

  1. What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)?

not applicable

Describe the bug

A clear and concise description of what the bug is.

Unit tests fails, for example:

 ---- tests::modules::serializer_deserializer::test_serialize_deserialize_timestamp stdout ----
 thread 'tests::modules::serializer_deserializer::test_serialize_deserialize_timestamp' panicked at 'assertion failed: `(left == right)`
   left: `[18, 0, 0, 0, 17, 107, 101, 121, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0]`,
  right: `[18, 0, 0, 0, 17, 107, 101, 121, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0]`', src/tests/modules/serializer_deserializer.rs:265:5
 stack backtrace:
    0: rust_begin_unwind
              at /usr/src/rustc-1.70.0/library/std/src/panicking.rs:578:5
    1: core::panicking::panic_fmt
              at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:67:14
    2: core::panicking::assert_failed_inner
    3: core::panicking::assert_failed
              at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:228:5
    4: bson::tests::modules::serializer_deserializer::test_serialize_deserialize_timestamp
              at ./src/tests/modules/serializer_deserializer.rs:265:5
    5: bson::tests::modules::serializer_deserializer::test_serialize_deserialize_timestamp::{{closure}}
              at ./src/tests/modules/serializer_deserializer.rs:250:43
    6: core::ops::function::FnOnce::call_once
              at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
    7: core::ops::function::FnOnce::call_once
              at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Full list of failing tests:

 failures:
     raw::test::append::timestamp
     raw::test::rawdoc_to_doc
     raw::test::timestamp
     tests::modules::macros::standard_format
     tests::modules::serializer_deserializer::test_serialize_deserialize_timestamp
     tests::spec::corpus::run

Build log with failing tests: https://ci.debian.net/packages/r/rust-bson/testing/s390x/43518187/

BE SPECIFIC:

  • What is the expected behavior and what is actually happening?

Expected: unit tests work

Actually happening: unit tests doesn't work

  • Do you have any particular output that demonstrates this problem?

https://ci.debian.net/packages/r/rust-bson/testing/s390x/43518187/

  • Do you have any ideas on why this may be happening that could give us a
    clue in the right direction?

I guess you are reading memory in an non-endian-safe manner

  • Did this issue arise out of nowhere, or after an update (of the driver,
    server, and/or Rust)?

No

  • Are there multiple ways of triggering this bug (perhaps more than one
    function produce a crash)?

not applicable

  • If you know how to reproduce this bug, please include a code snippet here:

I guess:

cargo test

To Reproduce
Steps to reproduce the behavior:

  1. First, do this.
  2. Then do this.
  3. After doing that, do this.
  4. And then, finally, do this.
  5. Bug occurs.
@abr-egn
Copy link
Contributor

abr-egn commented Mar 25, 2024

Thanks for the report, I'm looking into this!

@abr-egn abr-egn changed the title incorrect serialization/deserializer on big endian machines ( s390x ) RUST-1892 incorrect serialization/deserializer on big endian machines ( s390x ) Mar 25, 2024
@abr-egn abr-egn added the tracked-in-jira Ticket filed in Mongo's Jira system label Mar 25, 2024
@abr-egn
Copy link
Contributor

abr-egn commented Mar 26, 2024

Thanks again for bringing this to our attention - I have a fix in review and once it's merged we'll put out a point release to include it.

@alexanderkjall
Copy link
Author

Thanks a lot for being to responsive on this!

@abr-egn
Copy link
Contributor

abr-egn commented Apr 3, 2024

The fix for this is included in today's bson 2.10.0 release.

@abr-egn abr-egn closed this as completed Apr 3, 2024
@alexanderkjall
Copy link
Author

I can verify that the fix was successful: https://ci.debian.net/packages/r/rust-bson/testing/s390x/45197121/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracked-in-jira Ticket filed in Mongo's Jira system
Projects
None yet
Development

No branches or pull requests

2 participants