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

ws server: assert(self.locking_thread.load(.unordered) == Thread.getCurrentId()) fails sometimes #340

Open
krichprollsch opened this issue Dec 19, 2024 · 0 comments

Comments

@krichprollsch
Copy link
Member

I'm running the same code client multiple successive times on the server, and sometimes it panics on assertion:

debug(cdp): Req > id 6, method target.closeTarget
debug(cdp): Res > id 6, sessionID null, result cdp.target.closeTarget.Resp{ .success = true }
debug(cdp): Event > method Inspector.detached, sessionID CONTEXTSESSIONID0497A05C95417CF4
debug(websocket): (127.0.0.1:59782) connection closed: error.Closed
thread 102668 panic: reached unreachable code                                                                                               
debug(websocket): (127.0.0.1:59792) connected                    
debug(handler): connected to Stream server
debug(websocket): (127.0.0.1:59792) connection successfully upgraded                                                                        
debug(websocket): (127.0.0.1:59792) received text message
/usr/local/zig-0.13.0/lib/std/debug.zig:412:14: 0x1ad34dc in assert (lightpanda)
    if (!ok) unreachable; // assertion failure                                                                                              
             ^               
/usr/local/zig-0.13.0/lib/std/Thread/Mutex.zig:89:15: 0x1adad82 in unlock (lightpanda)
        assert(self.locking_thread.load(.unordered) == Thread.getCurrentId());                                              
              ^                                                                                                                             
/home/pierre/wrk/browser/vendor/websocket.zig/src/server/server.zig:1316:31: 0x1b6c601 in writeAllIOVec (lightpanda)
        defer self.lock.unlock();                                                                                                           
                              ^                                       
/home/pierre/wrk/browser/vendor/websocket.zig/src/server/server.zig:1303:34: 0x1b6cd20 in writeFrame (lightpanda)
        return self.writeAllIOVec(&vec);                                                                                                    
                                 ^                                    
/home/pierre/wrk/browser/vendor/websocket.zig/src/server/server.zig:1238:31: 0x1b6db9f in write (lightpanda)
        return self.writeFrame(.text, data);                                                                                                
                              ^                                       
/home/pierre/wrk/browser/src/handler.zig:73:34: 0x1b6dc31 in send (lightpanda)
        return self.ws_conn.write(data);                                                                                                    
                                 ^                                    
/home/pierre/wrk/browser/src/server.zig:286:28: 0x1b6e0ca in send (lightpanda)
            try stream.send(msg);                                                                                                           
                           ^                                          
/home/pierre/wrk/browser/src/cdp/cdp.zig:197:17: 0x21e5b61 in sendEvent__anon_34807 (lightpanda)
    try ctx.send(event_msg);                                                                                                                
                ^                                                                                                                           
/home/pierre/wrk/browser/src/cdp/target.zig:399:22: 0x2174f40 in closeTarget (lightpanda)
    try cdp.sendEvent(
                     ^                                                
/home/pierre/wrk/browser/src/cdp/target.zig:61:36: 0x2174b15 in target (lightpanda)
        .closeTarget => closeTarget(alloc, msg, ctx),
                                   ^
/home/pierre/wrk/browser/src/cdp/cdp.zig:89:26: 0x217577c in do (lightpanda)                                                                 
        .Target => target(alloc, &msg, action, ctx),
                         ^                                            
/home/pierre/wrk/browser/src/server.zig:263:27: 0x1f231e0 in do (lightpanda)                                                                 
        const res = cdp.do(self.alloc(), cmd, self) catch |err| {
                          ^                                           
/home/pierre/wrk/browser/src/server.zig:175:20: 0x1df8fd5 in readCbk (lightpanda)                                                            
            self.do(parts.msg) catch |err| {
                   ^                                                  
/home/pierre/wrk/browser/vendor/zig-js-runtime/vendor/tigerbeetle-io/io/linux.zig:762:29: 0x1d2169e in wrapper (lightpanda)                  
                    callback(                                         
                            ^                                         
/home/pierre/wrk/browser/vendor/zig-js-runtime/vendor/tigerbeetle-io/io/linux.zig:394:40: 0x1b07958 in complete (lightpanda)                 
                    completion.callback(completion.context, completion, &result);                                                            
                                       ^
/home/pierre/wrk/browser/vendor/zig-js-runtime/vendor/tigerbeetle-io/io/linux.zig:121:64: 0x1b06c71 in flush (lightpanda)                    
            while (copy.pop()) |completion| completion.complete();
                                                               ^
/home/pierre/wrk/browser/vendor/zig-js-runtime/vendor/tigerbeetle-io/io/linux.zig:90:27: 0x1b0876c in run_for_ns (lightpanda)                
            try self.flush(1, &timeouts, &etime);
                          ^                                           
/home/pierre/wrk/browser/src/server.zig:476:31: 0x1afbd50 in handle (lightpanda)                                                             
        try loop.io.run_for_ns(10 * std.time.ns_per_ms);
                              ^                                       
/usr/local/zig-0.13.0/lib/std/Thread.zig:429:13: 0x1b6f726 in callFn__anon_22799 (lightpanda)                                                
            @call(.auto, f, args) catch |err| {
            ^                                                         
/usr/local/zig-0.13.0/lib/std/Thread.zig:674:30: 0x1b09802 in entryFn (lightpanda)                                                           
                return callFn(f, args_ptr.*);
                             ^                                        
./nptl/pthread_create.c:447:8: 0x7f135a50ef51 in start_thread (pthread_create.c)                                                             
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0: 0x7f135a58d677 in __clone3 (../sysdeps/unix/sysv/linux/x86_64/clone3.S)                     
???:?:?: 0x0 in ??? (???)                                             
Aborted  
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

1 participant