Code Monkey home page Code Monkey logo

Comments (8)

eliias avatar eliias commented on September 28, 2024 1

@eliias Could you tell some details about the environment? I'm running your Rust debug example in windows rustc 1.65.0-nightly, yrs main branch (v0.12), and this check executes without issues. I can try to use macos as well, but I need to confirm if this issue is related to a particular build or not.

@Horusiath I can deterministically produce the error on a M1/Arm64 (MacOS 12.6), rustc version 1.63.0. I updated to 1.64.0, but same result. yrs is on 0.12 (the crate, not the main branch).

warning: `yrs` (lib) generated 27 warnings
   Compiling regression v0.1.0 (/Users/hannesmoser/src/github.com/y-crdt/yrb/examples/regression)
    Finished dev [unoptimized + debuginfo] target(s) in 8.86s
     Running `target/debug/regression`
thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside 'ば' (bytes 0..3) of `ばg`', library/core/src/str/mod.rs:127:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

from yrb.

eliias avatar eliias commented on September 28, 2024 1

@Iwark should be fixed with Release 0.3.2

from yrb.

eliias avatar eliias commented on September 28, 2024

@Iwark thanks for reporting. I am going to take a look.

Could you provide which type (Map, Array, Text, XMLElement, XMLText) and ID you use, e.g. doc.get_text("id")?

I can narrow down the issue to two updates (index: 1, 2), the others seem to work.

from yrb.

eliias avatar eliias commented on September 28, 2024

I have decoded the two updates, and I can't really see a problem. I then skipped the other updates and they worked, so I thought it might be conflicting updates and I found the pair that caused the issue. @Horusiath could you help here?

Test setup https://github.com/y-crdt/yrb/blob/add-lib0/spec/regression_spec.rb

" { blocks: UpdateBlocks { clients: {2807890757: [Item(<2807890757#0>, len: 1, parent: default: <xml element: paragraph>), Item(<2807890757#1>, len: 1, parent: <2807890757#0>: <xml text>), Item(<2807890757#2>, len: 1, parent: <2807890757#1>: 's')]} } }"
" { blocks: UpdateBlocks { clients: {2807890757: [Item(<2807890757#3>, len: 1, origin-l: <2807890757#2>: 'さ')]} }, delete set:  { 2807890757: [2..3) } }"
" { blocks: UpdateBlocks { clients: {2807890757: [Item(<2807890757#0>, len: 1, parent: default: <xml element: paragraph>), Item(<2807890757#1>, len: 1, parent: <2807890757#0>: <xml text>), Item(<2807890757#2>, len: 1, parent: <2807890757#1>: deleted(1)), Item(<2807890757#3>, len: 1, origin-l: <2807890757#2>: 'さ')]} }, delete set:  { 2807890757: [2..3) } }"
" { blocks: UpdateBlocks { clients: {2807890757: [Item(<2807890757#32>, len: 1, origin-l: <2807890757#0>: <xml element: paragraph>)]} } }"```

from yrb.

eliias avatar eliias commented on September 28, 2024

When I apply the update and xml.to_s, the output is:

"<UNDEFINED><paragraph>s</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さx</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁk</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁk</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこr</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれ</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれk</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれか</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれかr</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれからb</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれからb</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれからば</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれからば</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれからば</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/hannesmoser/.cargo/registry/src/github.com-1ecc6299db9ec823/yrs-0.12.0/src/block.rs:125:82
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"
"<UNDEFINED><paragraph>さぁこれから</paragraph></UNDEFINED>"

from yrb.

eliias avatar eliias commented on September 28, 2024

Here is a Rust only debug example https://github.com/y-crdt/yrb/blob/examples-rust-regression/examples/regression/src/main.rs

thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside 'ば' (bytes 0..3) of `ばg`', library/core/src/str/mod.rs:127:5
use yrs::updates::decoder::Decode;
use yrs::{Doc, Update};

fn main() {
    let diffs: Vec<Vec<u8>> = vec![
        vec![
            1, 3, 197, 134, 244, 186, 10, 0, 7, 1, 7, 100, 101, 102, 97, 117, 108, 116, 3, 9, 112,
            97, 114, 97, 103, 114, 97, 112, 104, 7, 0, 197, 134, 244, 186, 10, 0, 6, 4, 0, 197,
            134, 244, 186, 10, 1, 1, 115, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 3, 132, 197, 134, 244, 186, 10, 2, 3, 227, 129, 149, 1,
            197, 134, 244, 186, 10, 1, 2, 1,
        ],
        vec![
            1, 4, 197, 134, 244, 186, 10, 0, 7, 1, 7, 100, 101, 102, 97, 117, 108, 116, 3, 9, 112,
            97, 114, 97, 103, 114, 97, 112, 104, 7, 0, 197, 134, 244, 186, 10, 0, 6, 1, 0, 197,
            134, 244, 186, 10, 1, 1, 132, 197, 134, 244, 186, 10, 2, 3, 227, 129, 149, 1, 197, 134,
            244, 186, 10, 1, 2, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 4, 132, 197, 134, 244, 186, 10, 3, 1, 120, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 5, 132, 197, 134, 244, 186, 10, 4, 3, 227, 129, 129, 1,
            197, 134, 244, 186, 10, 1, 4, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 6, 132, 197, 134, 244, 186, 10, 5, 1, 107, 0,
        ],
        vec![
            1, 2, 197, 134, 244, 186, 10, 4, 129, 197, 134, 244, 186, 10, 3, 1, 132, 197, 134, 244,
            186, 10, 4, 3, 227, 129, 129, 1, 197, 134, 244, 186, 10, 1, 4, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 7, 132, 197, 134, 244, 186, 10, 6, 3, 227, 129, 147, 1,
            197, 134, 244, 186, 10, 1, 6, 1,
        ],
        vec![
            1, 2, 197, 134, 244, 186, 10, 6, 129, 197, 134, 244, 186, 10, 5, 1, 132, 197, 134, 244,
            186, 10, 6, 3, 227, 129, 147, 1, 197, 134, 244, 186, 10, 1, 6, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 8, 132, 197, 134, 244, 186, 10, 7, 1, 114, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 9, 132, 197, 134, 244, 186, 10, 8, 3, 227, 130, 140, 1,
            197, 134, 244, 186, 10, 1, 8, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 8, 132, 197, 134, 244, 186, 10, 7, 1, 114, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 10, 132, 197, 134, 244, 186, 10, 9, 1, 107, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 11, 132, 197, 134, 244, 186, 10, 10, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 10, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 12, 132, 197, 134, 244, 186, 10, 11, 1, 114, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 13, 132, 197, 134, 244, 186, 10, 12, 3, 227, 130, 137, 1,
            197, 134, 244, 186, 10, 1, 12, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 9, 132, 197, 134, 244, 186, 10, 8, 3, 227, 130, 140, 1,
            197, 134, 244, 186, 10, 1, 8, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 10, 132, 197, 134, 244, 186, 10, 9, 1, 107, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 11, 132, 197, 134, 244, 186, 10, 10, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 10, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 12, 132, 197, 134, 244, 186, 10, 11, 1, 114, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 14, 132, 197, 134, 244, 186, 10, 13, 1, 98, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 16, 132, 197, 134, 244, 186, 10, 15, 1, 103, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 15, 132, 197, 134, 244, 186, 10, 14, 3, 227, 129, 176, 1,
            197, 134, 244, 186, 10, 1, 14, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 17, 132, 197, 134, 244, 186, 10, 16, 3, 227, 129, 144, 1,
            197, 134, 244, 186, 10, 1, 16, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 17, 132, 197, 134, 244, 186, 10, 16, 3, 227, 129, 144, 1,
            197, 134, 244, 186, 10, 1, 16, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 18, 132, 197, 134, 244, 186, 10, 17, 6, 227, 131, 144,
            227, 130, 176, 1, 197, 134, 244, 186, 10, 2, 15, 1, 17, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 20, 132, 197, 134, 244, 186, 10, 19, 1, 103, 0,
        ],
        vec![
            1, 3, 197, 134, 244, 186, 10, 13, 132, 197, 134, 244, 186, 10, 12, 3, 227, 130, 137,
            129, 197, 134, 244, 186, 10, 13, 1, 132, 197, 134, 244, 186, 10, 14, 4, 227, 129, 176,
            103, 1, 197, 134, 244, 186, 10, 2, 12, 1, 14, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 21, 132, 197, 134, 244, 186, 10, 20, 3, 227, 129, 140, 1,
            197, 134, 244, 186, 10, 1, 20, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 23, 132, 197, 134, 244, 186, 10, 22, 3, 227, 129, 170, 1,
            197, 134, 244, 186, 10, 1, 22, 1,
        ],
        vec![
            1, 3, 197, 134, 244, 186, 10, 18, 132, 197, 134, 244, 186, 10, 17, 6, 227, 131, 144,
            227, 130, 176, 129, 197, 134, 244, 186, 10, 19, 1, 132, 197, 134, 244, 186, 10, 20, 3,
            227, 129, 140, 1, 197, 134, 244, 186, 10, 3, 15, 1, 17, 1, 20, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 24, 132, 197, 134, 244, 186, 10, 23, 3, 227, 129, 132, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 22, 132, 197, 134, 244, 186, 10, 21, 1, 110, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 26, 132, 197, 134, 244, 186, 10, 25, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 25, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 25, 132, 197, 134, 244, 186, 10, 24, 1, 107, 0,
        ],
        vec![
            1, 4, 197, 134, 244, 186, 10, 22, 129, 197, 134, 244, 186, 10, 21, 1, 132, 197, 134,
            244, 186, 10, 22, 6, 227, 129, 170, 227, 129, 132, 129, 197, 134, 244, 186, 10, 24, 1,
            132, 197, 134, 244, 186, 10, 25, 3, 227, 129, 139, 1, 197, 134, 244, 186, 10, 2, 22, 1,
            25, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 27, 132, 197, 134, 244, 186, 10, 26, 1, 100, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 28, 132, 197, 134, 244, 186, 10, 27, 3, 227, 129, 169, 1,
            197, 134, 244, 186, 10, 1, 27, 1,
        ],
        vec![
            1, 2, 197, 134, 244, 186, 10, 27, 129, 197, 134, 244, 186, 10, 26, 1, 132, 197, 134,
            244, 186, 10, 27, 3, 227, 129, 169, 1, 197, 134, 244, 186, 10, 1, 27, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 29, 132, 197, 134, 244, 186, 10, 28, 3, 227, 129, 134, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 30, 132, 197, 134, 244, 186, 10, 29, 1, 107, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 29, 132, 197, 134, 244, 186, 10, 28, 3, 227, 129, 134, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 31, 132, 197, 134, 244, 186, 10, 30, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 30, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 30, 132, 197, 134, 244, 186, 10, 29, 1, 107, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 31, 132, 197, 134, 244, 186, 10, 30, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 30, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 32, 135, 197, 134, 244, 186, 10, 0, 3, 9, 112, 97, 114,
            97, 103, 114, 97, 112, 104, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 32, 135, 197, 134, 244, 186, 10, 0, 3, 9, 112, 97, 114,
            97, 103, 114, 97, 112, 104, 0,
        ],
        vec![
            1, 2, 197, 134, 244, 186, 10, 33, 7, 0, 197, 134, 244, 186, 10, 32, 6, 4, 0, 197, 134,
            244, 186, 10, 33, 1, 107, 0,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 35, 132, 197, 134, 244, 186, 10, 34, 3, 227, 129, 139, 1,
            197, 134, 244, 186, 10, 1, 34, 1,
        ],
        vec![
            1, 1, 197, 134, 244, 186, 10, 36, 132, 197, 134, 244, 186, 10, 35, 1, 107, 0,
        ],
    ];

    let doc = Doc::new();
    let mut txn = doc.transact();
    for diff in diffs {
        Update::decode_v1(diff.as_slice())
            .map(|update| txn.apply_update(update))
            .expect("applying update failed");
    }
}

from yrb.

Horusiath avatar Horusiath commented on September 28, 2024

@eliias Could you tell some details about the environment? I'm running your Rust debug example in windows rustc 1.65.0-nightly, yrs main branch (v0.12), and this check executes without issues. I can try to use macos as well, but I need to confirm if this issue is related to a particular build or not.

from yrb.

Iwark avatar Iwark commented on September 28, 2024

Thank you so much!

from yrb.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.