Nix repl stuck in infinite startup loop

Problem description:
Infinite loop when booting repl (loading nix environment)

Expected behavior:
Repl starts as normal, allowing code to be edited and run.

Actual behavior:
Repl alternates between “booting repl”, “connected”, and “reconnecting”, in an infinite loop. The “connected” phase lasts less than a second, while the other phases typically take 10-15 seconds.

Steps to reproduce:
Create a new nix repl (or any repl, really), and edit the replit.nix file to add/remove packages. At least on my account, this causes the infinite restart loop, even in a new, empty *nix repl.
This bug does not occur if the replit.nix file isn’t edited, suggesting it’s some issue with how packages are being loaded.

Bug appears at this link:
https://replit.com/@ndrewxie/FSMRegex

Browser/OS/Device:
Dell chromebook 11, ChromeOS

1 Like

I ran the Repl you’ve linked and got

This
cargo fmt --all && CARGO_HOME=cargocache cargo test --all -- --nocapture --test-threads=1
   Compiling libc v0.2.139
   Compiling memchr v2.5.0
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.17.1
   Compiling regex-syntax v0.6.28
   Compiling unicode-width v0.1.10
   Compiling smawk v0.3.1
   Compiling ahash v0.7.6
   Compiling getrandom v0.2.8
   Compiling aho-corasick v0.7.20
   Compiling regex v1.7.1
   Compiling hashbrown v0.12.3
   Compiling unicode-linebreak v0.1.4
   Compiling textwrap v0.16.0
   Compiling fsmregex v0.1.0 (/home/runner/KYbcLzKqd1L)
warning: unused variable: `num_registers`
   --> src/tests.rs:179:10
    |
179 |     let (num_registers, num_tags, dfa, nfa) = compiler.compile(regex);
    |          ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_num_registers`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `num_tags`
   --> src/tests.rs:179:25
    |
179 |     let (num_registers, num_tags, dfa, nfa) = compiler.compile(regex);
    |                         ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_num_tags`

warning: unused variable: `dfa`
   --> src/tests.rs:179:35
    |
179 |     let (num_registers, num_tags, dfa, nfa) = compiler.compile(regex);
    |                                   ^^^ help: if this is intentional, prefix it with an underscore: `_dfa`

warning: unused variable: `nfa`
   --> src/tests.rs:179:40
    |
179 |     let (num_registers, num_tags, dfa, nfa) = compiler.compile(regex);
    |                                        ^^^ help: if this is intentional, prefix it with an underscore: `_nfa`

warning: `fsmregex` (lib test) generated 4 warnings
    Finished test [unoptimized + debuginfo] target(s) in 2m 02s
     Running unittests (target/debug/deps/fsmregex-62ee0ade41e0bacc)

running 15 tests
test charset::tests::test_disjoint ... ok
test charset::tests::test_intersection ... ok
test charset::tests::test_minus ... ok
test parser_tests::test_balanced ... ok
test parser_tests::test_escapes ... ok
test parser_tests::test_parse ... Some(
    Tag(
        Optional(
            Repeat(
                Chain(
                    [
                        Char(
                            Allow(
                                {
                                    'a',
                                },
                            ),
                        ),
                        Char(
                            Allow(
                                {
                                    'b',
                                },
                            ),
                        ),
                        Char(
                            Allow(
                                {
                                    'c',
                                },
                            ),
                        ),
                        Char(
                            Allow(
                                {
                                    'd',
                                },
                            ),
                        ),
                    ],
                ),
            ),
        ),
        "hi",
    ),
)
ok
test tests::test_alternation ... thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some((2, []))`', src/tests.rs:47:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
FAILED
test tests::test_asdf ... ok
test tests::test_chain ... thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some((17, []))`', src/tests.rs:74:5
FAILED
test tests::test_quoted_string ... ok
test tests::test_string_match_casesensitive ... ok
test tests::test_string_match_ignorecase ... ok
test tests::test_tag_repeating_complex ... ok
test tests::test_tag_repeating_simple ... ok
test tests::test_tag_simple ... ok

failures:

failures:
    tests::test_alternation
    tests::test_chain

test result: FAILED. 13 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s

error: test failed, to rerun pass '--lib'
exit status 101

(It’s very long.) I don’t see any Nix error, it seems this error is to do with your code… That said, I don’t know if you can see any Nix errors without actually being in the editor, but the fact is I could run the Repl.

Hmm. There definitely is an error in my code, but I physically cannot enter into the editor to change it, as I’m still getting into an infinite loop

1 Like

I suppose I could try re-making the repl with the errors fixed, and that would probably eliminate the issue. However, I believe that it’s still a replit bug, as a code error shouldn’t make it impossible to modify files within the repl.

1 Like

I fixed all the errors and uploaded it to a new repl, but the moment I paste in my replit.nix file, the restart loop occurs again.
Reverting to the old, default replit.nix file does nothing, presumably cuz it’s not saving due to the restart loop.

https://replit.com/@ndrewxie/DFA-Regex
(new repl)

1 Like

Does forking the repl help in any way?

1 Like

Well, the issue appears to have resolved itself. IDK was up with it yesterday, but even so much as creating a new rust repl and editing the replit.nix file would reproduce the error, but today, I can re-open all repls perfectly fine.

But to answer your question, at least yesterday, forking did not do anything. The solution that did work for me (even yesterday) was to create a brand new *nix repl (NOT a rust repl, because editing the replit.nix file would cause issues there), and then uploading my code files one-by-one onto the *nix repl.

But just to confirm, it’s all good now - even the original rust repl is OK. IDK what exactly caused it but :person_shrugging:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.