rcore-os / rCore

Rust version of THU uCore OS. Linux compatible.
MIT License
3.43k stars 369 forks source link

A deadlock occurred while using a user network program #82

Open elliott10 opened 3 years ago

elliott10 commented 3 years ago

A deadlock occurred while using a user network program

Run network command in the rCore:

/busybox nc -l -p 8080

Deadlock detected! locked by cpu 0 thread 0

The error log as follow:

[ WARN][0,-] 0:2:2 syscall id 54, args:[3, 1, 2, 140737488354604, 4, 0] 
[ INFO][0,-] setsockopt: fd: 3, level: 1, optname: 2
[ WARN][0,-] setsockopt is unimplemented
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 49, args:[3, 20836, 16, 0, 0, 0] 
[ INFO][0,-] sys_bind: fd: 3 addr: 0x5164 len: 16
[ INFO][0,-] sys_bind: fd: 3 bind to Ip(Endpoint { addr: Ipv4(Address([0, 0, 0, 0])), port: 8080 })
[ INFO][0,-] => Ok(0)
[ INFO][0,-] page fault from user @ 0x42ce4e
[DEBUG][0,-] file handle page fault, and fill data 
[ INFO][0,-] page fault from user @ 0x4c0114
[DEBUG][0,-] file handle page fault, and fill data 
[ INFO][0,-] thread 2 yield_now
[ WARN][0,-] 0:2:2 syscall id 50, args:[3, 1, 0, 0, 0, 0] 
[ INFO][0,-] sys_listen: fd: 3 backlog: 1
[ INFO][0,-] socket listening on Endpoint { addr: Ipv4(Address([0, 0, 0, 0])), port: 8080 }
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 13, args:[14, 140737488354032, 140737488354064, 8, 14, 0] 
[ INFO][0,-] rt_sigaction: signum: SIGALRM, act: 0x7ffffffffaf0, oldact: 0x7ffffffffb10, sigsetsize: 8
[ INFO][0,-] new action: SIGALRM -> signal action { handler: 42cd92, mask: Sigset(0), flags: RESTART | RESTORER, restorer: 4c9140 }
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 38, args:[0, 140737488354416, 140737488354416, 8, 8, 0] 
[ WARN][0,-] setitimer is unimplemented
[ INFO][0,-] => Ok(0)
[ INFO][0,-] page fault from user @ 0x4ce340
[DEBUG][0,-] file handle page fault, and fill data 
[ WARN][0,-] 0:2:2 syscall id 43, args:[3, 4188, 4184, 0, 0, 0] 
[ INFO][0,-] sys_accept: fd: 3 addr: 0x105c addr_len: 0x1058
[ERROR][0,-] Mutex: deadlock detected! locked by cpu 0 thread 0 @ 0xffffff0002d86280
[ERROR][0,-] 

panicked at 'attempt to add with overflow', src/sync/mutex.rs:105:17
=== BEGIN rCore stack trace ===
#00 PC: 0xFFFFFF000020FE9B FP: 0xFFFFFF01001FF5A0
#01 PC: 0xFFFFFF000022C767 FP: 0xFFFFFF01001FF600
#02 PC: 0xFFFFFF000022C6BF FP: 0xFFFFFF01001FF630
#03 PC: 0xFFFFFF00000BB7D0 FP: 0xFFFFFF01001FF680
#04 PC: 0xFFFFFF00000DA0DD FP: 0xFFFFFF01001FF740
#05 PC: 0xFFFFFF0000126744 FP: 0xFFFFFF01001FFA20
#06 PC: 0xFFFFFF00000FCB71 FP: 0xFFFFFF01001FFB90
#07 PC: 0xFFFFFF00000FA500 FP: 0xFFFFFF01001FFD30
#08 PC: 0xFFFFFF00000F5D2E FP: 0xFFFFFF01001FFDE0
#09 PC: 0xFFFFFF0000175AB6 FP: 0xFFFFFF01001FFED0
#10 PC: 0xFFFFFF00000B48FD FP: 0xFFFFFF01001FFF30
#11 PC: 0xFFFFFF00002353F9 FP: 0xFFFFFF01001FFF40
=== END rCore stack trace ===