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

bug: concurrent map read and map write. #5

Closed
bruce2233 opened this issue Aug 12, 2022 · 1 comment
Closed

bug: concurrent map read and map write. #5

bruce2233 opened this issue Aug 12, 2022 · 1 comment
Assignees
Labels
bug Something isn't working reactor

Comments

@bruce2233
Copy link
Owner

bug occurs at evnet/reactor.go:184

fatal error: concurrent map read and map write.
goroutine 7 [running]:
runtime.throw({0x578192?, 0x13?})
        /usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc000214eb0 sp=0xc000214e80 pc=0x436d71
runtime.mapaccess1_fast64(0xc000214f18?, 0xc0003221e0?, 0x18)
        /usr/local/go/src/runtime/map_fast64.go:22 +0x172 fp=0xc000214ed0 sp=0xc000214eb0 pc=0x4128f2
github.com/bruce2233/evnet.(*SubReactor).Loop(0xc00007c870)
        /home/bruce/github/evnet/reactor.go:184 +0x189 fp=0xc000214fb0 sp=0xc000214ed0 pc=0x52ebc9
github.com/bruce2233/evnet.startSubReactor(0x57cc50?)
        /home/bruce/github/evnet/reactor.go:135 +0x19 fp=0xc000214fc8 sp=0xc000214fb0 pc=0x52e579
github.com/bruce2233/evnet.(*MainReactor).Init.func1()
        /home/bruce/github/evnet/reactor.go:121 +0x26 fp=0xc000214fe0 sp=0xc000214fc8 pc=0x52e526
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000214fe8 sp=0xc000214fe0 pc=0x467f01
created by github.com/bruce2233/evnet.(*MainReactor).Init
        /home/bruce/github/evnet/reactor.go:121 +0x335

goroutine 1 [chan receive]:
testing.(*T).Run(0xc00009ad00, {0x572495?, 0x4c12e5?}, 0x57cc50)
        /usr/local/go/src/testing/testing.go:1487 +0x37a
testing.runTests.func1(0xc00007c840?)
        /usr/local/go/src/testing/testing.go:1839 +0x6e
testing.tRunner(0xc00009ad00, 0xc000063cd8)
        /usr/local/go/src/testing/testing.go:1439 +0x102
testing.runTests(0xc0000a0320?, {0x678a60, 0x4, 0x4}, {0x7fcf6903d108?, 0x40?, 0x67d8c0?})
        /usr/local/go/src/testing/testing.go:1837 +0x457
testing.(*M).Run(0xc0000a0320)
        /usr/local/go/src/testing/testing.go:1719 +0x5d9
main.main()
        _testmain.go:53 +0x1aa

goroutine 6 [runnable]:
github.com/bruce2233/evnet.addPollRead(0x7?, 0x3e?)
        /home/bruce/github/evnet/reactor.go:217 +0xd3
github.com/bruce2233/evnet.(*Poller).AddPollRead(...)
        /home/bruce/github/evnet/reactor.go:213
github.com/bruce2233/evnet.registerConn(0xc00007c870, {0x5a58e8, 0xc000012780})
        /home/bruce/github/evnet/reactor.go:226 +0xa6
github.com/bruce2233/evnet.(*MainReactor).Loop(0xc0000c9ed8)
        /home/bruce/github/evnet/reactor.go:170 +0x445
github.com/bruce2233/evnet.serve(...)
        /home/bruce/github/evnet/evnet.go:40
github.com/bruce2233/evnet.Run({0x5a54e0?, 0x6ac6d8}, {0xc000018120, 0x14}, {0x0, 0x0, 0x47a9f7?})
        /home/bruce/github/evnet/evnet.go:25 +0x252
github.com/bruce2233/evnet.TestMainRec(0x0?)
        /home/bruce/github/evnet/evnet_test.go:41 +0x5f
testing.tRunner(0xc00009aea0, 0x57cc50)
        /usr/local/go/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1486 +0x35f

goroutine 8 [runnable]:
sync.runtime_SemacquireMutex(0x100?, 0xa0?, 0x46dae9?)
        /usr/local/go/src/runtime/sema.go:71 +0x25
sync.(*Mutex).lockSlow(0xc00007a0a0)
        /usr/local/go/src/sync/mutex.go:162 +0x165
sync.(*Mutex).Lock(...)
        /usr/local/go/src/sync/mutex.go:81
log.(*Logger).Output(0xc00007a0a0, 0x3?, {0xc0002b62d0, 0x30})
        /usr/local/go/src/log/log.go:176 +0x9c
log.Println({0xc00005ef18?, 0xc00007c900?, 0x22?})
        /usr/local/go/src/log/log.go:360 +0x50
github.com/bruce2233/evnet.(*SubReactor).Loop(0xc00007c8d0)
        /home/bruce/github/evnet/reactor.go:185 +0x22a
github.com/bruce2233/evnet.startSubReactor(0x0?)
        /home/bruce/github/evnet/reactor.go:135 +0x19
created by github.com/bruce2233/evnet.(*MainReactor).Init
        /home/bruce/github/evnet/reactor.go:121 +0x335

goroutine 9 [syscall]:
syscall.Syscall6(0xe8, 0x9, 0xc000025200, 0x80, 0xffffffffffffffff, 0x0, 0x0)
        /usr/local/go/src/syscall/asm_linux_amd64.s:43 +0x5
golang.org/x/sys/unix.EpollWait(0x67d8c0?, {0xc000025200?, 0x0?, 0x52d5c0?}, 0xc00007a0a0?)
        /home/bruce/go/pkg/mod/golang.org/x/sys@v0.0.0-20220808155132-1c4a2a72c664/unix/zsyscall_linux_amd64.go:56 +0x58
github.com/bruce2233/evnet.polling(0xc000053718?)
        /home/bruce/github/evnet/reactor.go:267 +0x66
github.com/bruce2233/evnet.(*Poller).Polling(...)
        /home/bruce/github/evnet/reactor.go:257
github.com/bruce2233/evnet.(*SubReactor).Loop(0xc00007c930)
        /home/bruce/github/evnet/reactor.go:178 +0xbb
github.com/bruce2233/evnet.startSubReactor(0x0?)
        /home/bruce/github/evnet/reactor.go:135 +0x19
created by github.com/bruce2233/evnet.(*MainReactor).Init
        /home/bruce/github/evnet/reactor.go:121 +0x335

goroutine 10 [syscall]:
syscall.Syscall6(0xe8, 0xa, 0xc000198600, 0x80, 0xffffffffffffffff, 0x0, 0x0)
        /usr/local/go/src/syscall/asm_linux_amd64.s:43 +0x5
golang.org/x/sys/unix.EpollWait(0x67d8c0?, {0xc000198600?, 0x0?, 0x52d5c0?}, 0xc00007a0a0?)
        /home/bruce/go/pkg/mod/golang.org/x/sys@v0.0.0-20220808155132-1c4a2a72c664/unix/zsyscall_linux_amd64.go:56 +0x58
github.com/bruce2233/evnet.polling(0xc000053f18?)
        /home/bruce/github/evnet/reactor.go:267 +0x66
github.com/bruce2233/evnet.(*Poller).Polling(...)
        /home/bruce/github/evnet/reactor.go:257
github.com/bruce2233/evnet.(*SubReactor).Loop(0xc00007c990)
        /home/bruce/github/evnet/reactor.go:178 +0xbb
github.com/bruce2233/evnet.startSubReactor(0x0?)
        /home/bruce/github/evnet/reactor.go:135 +0x19
created by github.com/bruce2233/evnet.(*MainReactor).Init
        /home/bruce/github/evnet/reactor.go:121 +0x335

goroutine 11 [syscall]:
syscall.Syscall6(0xe8, 0xb, 0xc000024c00, 0x80, 0xffffffffffffffff, 0x0, 0x0)
        /usr/local/go/src/syscall/asm_linux_amd64.s:43 +0x5
golang.org/x/sys/unix.EpollWait(0x67d8c0?, {0xc000024c00?, 0x0?, 0x52d5c0?}, 0xc00007a0a0?)
        /home/bruce/go/pkg/mod/golang.org/x/sys@v0.0.0-20220808155132-1c4a2a72c664/unix/zsyscall_linux_amd64.go:56 +0x58
github.com/bruce2233/evnet.polling(0xc00004c718?)
        /home/bruce/github/evnet/reactor.go:267 +0x66
github.com/bruce2233/evnet.(*Poller).Polling(...)
        /home/bruce/github/evnet/reactor.go:257
github.com/bruce2233/evnet.(*SubReactor).Loop(0xc00007c9f0)
        /home/bruce/github/evnet/reactor.go:178 +0xbb
github.com/bruce2233/evnet.startSubReactor(0x0?)
        /home/bruce/github/evnet/reactor.go:135 +0x19
created by github.com/bruce2233/evnet.(*MainReactor).Init
        /home/bruce/github/evnet/reactor.go:121 +0x335
FAIL    github.com/bruce2233/evnet      6.914s
FAIL
@bruce2233 bruce2233 added bug Something isn't working reactor labels Aug 12, 2022
@bruce2233 bruce2233 self-assigned this Aug 12, 2022
@bruce2233
Copy link
Owner Author

Bug has fixed by RWMutex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reactor
Projects
None yet
Development

No branches or pull requests

1 participant