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

Running eqwalizer crashes with error "Expand phase should validate that all remoteIds point to modules that exist, but found eqwalizer:dynamic/0" #6

Closed
jesperes opened this issue Aug 17, 2022 · 5 comments

Comments

@jesperes
Copy link

I tried running eqwalizer on our codebase, but it consistently crashes with

15:52 $ RUST_BACKTRACE=full elp eqwalize kred
  Loading rebar3 build_info
  Loading applications      ████████████████████ 263/263
  Seeding database
  Compiling dependencies
Exception in thread "main" java.lang.IllegalStateException: Expand phase should validate that all remoteIds point to modules that exist, but found eqwalizer:dynamic/0
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$getTypeDeclBody$1(Contractivity.scala:119)
	at scala.Option.getOrElse(Option.scala:201)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.getTypeDeclBody(Contractivity.scala:118)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:89)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:79)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5$adapted(Contractivity.scala:75)
	at scala.collection.immutable.Set$Set2.forall(Set.scala:207)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:91)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4$adapted(Contractivity.scala:71)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5$adapted(Contractivity.scala:75)
	at scala.collection.immutable.Set$Set3.forall(Set.scala:258)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$8(Contractivity.scala:81)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$8$adapted(Contractivity.scala:81)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:81)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:91)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$5$adapted(Contractivity.scala:75)
	at scala.collection.immutable.Set$Set3.forall(Set.scala:258)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:75)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:91)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$3(Contractivity.scala:69)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$3$adapted(Contractivity.scala:69)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:69)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4$adapted(Contractivity.scala:71)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:91)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4$adapted(Contractivity.scala:71)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:73)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$8(Contractivity.scala:81)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$8$adapted(Contractivity.scala:81)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:81)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:91)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:73)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$isFoldable$4$adapted(Contractivity.scala:71)
	at scala.collection.immutable.List.forall(List.scala:386)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isFoldable(Contractivity.scala:71)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.isContractive(Contractivity.scala:58)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.addTypeDecl(Contractivity.scala:36)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$checkStub$1(Contractivity.scala:22)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.$anonfun$checkStub$1$adapted(Contractivity.scala:22)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:926)
	at com.whatsapp.eqwalizer.ast.stub.Contractivity.checkStub(Contractivity.scala:22)
	at com.whatsapp.eqwalizer.ast.stub.Db$.$anonfun$getContractiveModuleStub$1(Db.scala:162)
	at scala.Option.map(Option.scala:242)
	at com.whatsapp.eqwalizer.ast.stub.Db$.getContractiveModuleStub(Db.scala:160)
	at com.whatsapp.eqwalizer.ast.stub.Db$.getModuleStub(Db.scala:174)
	at com.whatsapp.eqwalizer.ast.stub.DbApi$.$anonfun$getOverloadedSpec$1(DbApi.scala:45)
	at scala.Option.orElse(Option.scala:477)
	at com.whatsapp.eqwalizer.ast.stub.DbApi$.getOverloadedSpec(DbApi.scala:45)
	at com.whatsapp.eqwalizer.tc.Util.getOverloadedSpec(Util.scala:78)
	at com.whatsapp.eqwalizer.tc.ElabApplyOverloaded.isOverloadedFun(ElabApplyOverloaded.scala:58)
	at com.whatsapp.eqwalizer.tc.Elab.elabExpr(Elab.scala:180)
	at com.whatsapp.eqwalizer.tc.Elab.$anonfun$elabBody$1(Elab.scala:34)
	at com.whatsapp.eqwalizer.tc.Elab.$anonfun$elabBody$1$adapted(Elab.scala:33)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at com.whatsapp.eqwalizer.tc.Elab.elabBody(Elab.scala:33)
	at com.whatsapp.eqwalizer.tc.Elab.elabClause(Elab.scala:48)
	at com.whatsapp.eqwalizer.tc.Elab.$anonfun$elabExpr$12(Elab.scala:238)
	at scala.collection.LazyZip2$$anon$1$$anon$2.next(LazyZipOps.scala:42)
	at scala.collection.immutable.List.prependedAll(List.scala:153)
	at scala.collection.immutable.List$.from(List.scala:684)
	at scala.collection.immutable.List$.from(List.scala:681)
	at scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:112)
	at scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:109)
	at scala.collection.LazyZip2.map(LazyZipOps.scala:37)
	at com.whatsapp.eqwalizer.tc.Elab.elabExpr(Elab.scala:238)
	at com.whatsapp.eqwalizer.tc.Check.checkExpr(Check.scala:93)
	at com.whatsapp.eqwalizer.tc.Check.checkBody(Check.scala:58)
	at com.whatsapp.eqwalizer.tc.Check.checkClause(Check.scala:74)
	at com.whatsapp.eqwalizer.tc.Check.$anonfun$checkFun$1(Check.scala:38)
	at scala.collection.LazyZip2$$anon$1$$anon$2.next(LazyZipOps.scala:42)
	at scala.collection.immutable.List.prependedAll(List.scala:153)
	at scala.collection.immutable.List$.from(List.scala:684)
	at scala.collection.immutable.List$.from(List.scala:681)
	at scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:112)
	at scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:109)
	at scala.collection.LazyZip2.map(LazyZipOps.scala:37)
	at com.whatsapp.eqwalizer.tc.Check.checkFun(Check.scala:38)
	at com.whatsapp.eqwalizer.Pipeline$.tolerantCheckFun(Pipeline.scala:156)
	at com.whatsapp.eqwalizer.Pipeline$.checkFun(Pipeline.scala:136)
	at com.whatsapp.eqwalizer.Pipeline$.$anonfun$checkForms$2(Pipeline.scala:61)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at com.whatsapp.eqwalizer.Pipeline$.checkForms(Pipeline.scala:44)
	at com.whatsapp.eqwalizer.util.ELPDiagnostics$.getDiagnostics(ELPDiagnostics.scala:61)
	at com.whatsapp.eqwalizer.util.ELPDiagnostics$.$anonfun$getDiagnosticsIpc$1(ELPDiagnostics.scala:50)
	at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
	at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
	at scala.collection.mutable.ArraySeq.map(ArraySeq.scala:37)
	at com.whatsapp.eqwalizer.util.ELPDiagnostics$.getDiagnosticsIpc(ELPDiagnostics.scala:49)
	at com.whatsapp.eqwalizer.Main$.ipc(Main.scala:70)
	at com.whatsapp.eqwalizer.Main$.main(Main.scala:33)
	at com.whatsapp.eqwalizer.Main.main(Main.scala)
thread 'main' panicked at 'failed to parse stdout from eqwalizer: Error("EOF while parsing a value", line: 1, column: 0)', crates/eqwalizer/src/ipc.rs:82:40
stack backtrace:
   0:     0x558c7efd7f00 - std::backtrace_rs::backtrace::libunwind::trace::h8e036432725b1c57
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x558c7efd7f00 - std::backtrace_rs::backtrace::trace_unsynchronized::h4f83092254c85869
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x558c7efd7f00 - std::sys_common::backtrace::_print_fmt::h9728b5e056a3ece3
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x558c7efd7f00 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h48bb4bd2928827d2
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x558c7ee3596c - core::fmt::write::h909e69a2c24f44cc
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17
   5:     0x558c7efb0670 - std::io::Write::write_fmt::h7f4b8ab8af89e9ef
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15
   6:     0x558c7efda0a5 - std::sys_common::backtrace::_print::hff4838ebf14a2171
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x558c7efda0a5 - std::sys_common::backtrace::print::h2499280374189ad9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x558c7efda0a5 - std::panicking::default_hook::{{closure}}::h8b270fc55eeb284e
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22
   9:     0x558c7efdaf4a - std::panicking::default_hook::h3217e229d6e9d13c
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9
  10:     0x558c7efdaf4a - std::panicking::rust_panic_with_hook::h9acb8048b738d2e0
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:698:17
  11:     0x558c7efdaa82 - std::panicking::begin_panic_handler::{{closure}}::h70f3b839526af6dc
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:588:13
  12:     0x558c7efda9f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h1ecf2cee857fbe0a
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x558c7efda9b2 - rust_begin_unwind
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
  14:     0x558c7edf2702 - core::panicking::panic_fmt::h9f8393e7fd56d655
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
  15:     0x558c7edf2982 - core::result::unwrap_failed::h8b88eb424b1f8daa
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
  16:     0x558c7eeb8653 - elp_eqwalizer::Eqwalizer::typecheck::he26c8b72aff1bd95
  17:     0x558c7eec10d9 - <elp_ide_db::RootDatabase as elp_ide_db::eqwalizer::EqwalizerLoader>::typecheck::h776d2505fa2cc139
  18:     0x558c7eea3021 - salsa::derived::slot::Slot<Q,MP>::read_upgrade::h63af845d03970a2c
  19:     0x558c7eea9fb6 - <DB as elp_ide_db::eqwalizer::EqwalizerDatabase>::eqwalizer_diagnostics::__shim::h761134f712622a20
  20:     0x558c7ee64437 - elp::eqwalizer_cli::eqwalize::h6462a4a26072f752
  21:     0x558c7ee633e4 - elp::eqwalizer_cli::eqwalize_module::hcac24d94411dec81
  22:     0x558c7ee69e34 - elp::main::h559b5163e6c6c796
  23:     0x558c7ee50513 - std::sys_common::backtrace::__rust_begin_short_backtrace::h425c6ab1d60f4a48
  24:     0x558c7ee69112 - main
  25:     0x7f945b0cc083 - __libc_start_main
                               at /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
  26:     0x558c7ee08e7e - _start
  27:                0x0 - <unknown>

Eqwalizer works fine on a small toy project, so I am guessing this is related somehow to our rebar3 configuration, but I don't understand what the error message means.

OTP: 25.0.2
Eqwalizer: 0.8.2

@ilya-klyuchnikov
Copy link
Member

yes, it means that the third-party dependency https://github.com/WhatsApp/eqwalizer/tree/main/eqwalizer_support (which is required by eqwalizer) is somehow not present

@ilya-klyuchnikov
Copy link
Member

ilya-klyuchnikov commented Aug 17, 2022

Probably we can add sanity-check validation that it's present to be more user-friendly.

@ilya-klyuchnikov
Copy link
Member

I have working configs for a bunch of non-toy applications like aeternity - let me share them in a couple of days as examples. Thanks

@ilya-klyuchnikov
Copy link
Member

#7

@jesperes
Copy link
Author

Ah, I might have put the eqwalizer_support as a "plugin", not a "dependency".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants