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

Add support for shadow-cljs #3

Open
jeaye opened this issue Oct 3, 2024 · 4 comments
Open

Add support for shadow-cljs #3

jeaye opened this issue Oct 3, 2024 · 4 comments
Assignees

Comments

@jeaye
Copy link
Member

jeaye commented Oct 3, 2024

We want to run these tests with both CLJ and CLJS. To do so, we need to bring in shadow-cljs. We'll also need to tweak some of the tests to use reader conditionals, particularly around (thrown? Foo ...) forms.

@jaidetree
Copy link
Contributor

Will take this on, thinking of getting CI done first then can do this and add it to CI

@dgr
Copy link
Contributor

dgr commented Jan 17, 2025

I've started running the CLJS tests and looking at the errors. I'm seeing an out of memory exception during the compilation phase, however. Is this expected? Note, ignore the error in test-compare. That's just the last of a long line of errors caused by differences between Clojure JVM and CLJS that I'll take a look at that.

Testing clojure.core-test.compare

ERROR in (test-compare) (:)
collection-types
expected: (zero? (compare (first [{} (hash-map)]) (second [{} (hash-map)])))
  actual: #object[Error Error: Cannot compare {} to {}]

<--- Last few GCs --->

[20685:0x158030000]    65113 ms: Scavenge (interleaved) 4081.8 (4096.9) -> 4076.1 (4098.2) MB, pooled: 0 MB, 17.17 / 0.00 ms  (average mu = 0.260, current mu = 0.263) allocation failure; 
[20685:0x158030000]    69889 ms: Mark-Compact (reduce) 4076.2 (4098.2) -> 4076.1 (4084.4) MB, pooled: 0 MB, 3879.67 / 0.00 ms  (+ 0.6 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 3918 ms) (average mu = 0.241, 

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0x100d8866c node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 2: 0x100f30740 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 3: 0x1010ed6f0 v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 4: 0x1010f3188 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1::operator()() const [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 5: 0x1010eda34 void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1>(heap::base::Stack*, void*, void const*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 6: 0x100ca0028 PushAllRegistersAndIterateStack [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 7: 0x1010ea91c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 8: 0x10108ef9c v8::internal::StackGuard::HandleInterrupts(v8::internal::StackGuard::InterruptLevel) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
 9: 0x101398234 v8::internal::Runtime_HandleNoHeapWritesInterrupts(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
10: 0x100b7f9f4 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node/23.6.0/bin/node]
11: 0x1093265dc 
12: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
13: 0x1092778f8 
14: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
15: 0x100ba5408 Builtins_ArrayPrototypeJoin [/opt/homebrew/Cellar/node/23.6.0/bin/node]
16: 0x10931a1e8 
17: 0x10930fab0 
18: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
19: 0x109279f74 
20: 0x109250248 
21: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
22: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
23: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
24: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
25: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
26: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
27: 0x1091ef6d0 
28: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
29: 0x1091de6ac 
30: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
31: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
32: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
33: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
34: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
35: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
36: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
37: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
38: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
39: 0x100ae8838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
40: 0x100ae650c Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/23.6.0/bin/node]
41: 0x100ae61b0 Builtins_JSEntry [/opt/homebrew/Cellar/node/23.6.0/bin/node]
42: 0x101062604 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
43: 0x101061f6c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
44: 0x100f47280 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
45: 0x100d65c5c node::builtins::BuiltinLoader::CompileAndCall(v8::Local<v8::Context>, char const*, node::Realm*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
46: 0x100e046ec node::Realm::ExecuteBootstrapper(char const*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
47: 0x100d43ac0 node::StartExecution(node::Environment*, char const*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
48: 0x100d43a60 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
49: 0x100ca6eac node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>, std::__1::function<void (node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Value>)>) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
50: 0x100dcfd48 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
51: 0x100dcfb00 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/23.6.0/bin/node]
52: 0x100d4889c node::Start(int, char**) [/opt/homebrew/Cellar/node/23.6.0/bin/node]
53: 0x1941c8274 start [/usr/lib/dyld]
===============================================
[:test] Build completed. (149 files, 23 compiled, 173 warnings, 72.07s)

@jaidetree
Copy link
Contributor

First, the tests are compiling as they have to be compiled to a node js script to run at all.

That error is partially expected. Encountered it locally and in ci, but was hoping that was a side effect of all the broken tests. Anyway, I'll modify the list of tests it runs and pinpoint the one spiking the memory.

@dgr
Copy link
Contributor

dgr commented Jan 17, 2025

Yea, there is a particular assertion that is causing the issue. It's this one:

(is (thrown? #?(:cljs :default :clj Exception) (compare (range 5) (range))))

The system doesn't seem to like the infinite sequence generated by (range). I'll update the test. I'm not sure it's valid in any case since sequences don't implement java.lang.Comparable.

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

3 participants