You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The chan struct{} in Stream, such as recvNotifyCh, sendNotifyCh, readDeadline, writeDeadline, is never closed?
The problem is that: In server I call Host.NewStream (in go-libp2p-core) to get a stream, and write something to this stream, then close the stream. The client will receive this message and output it in the console, close too.
However, the memory continues growing, and I use pprof to test why this happens, and the memory occupied by the channels is large and still growing.
I try to output the size of session.streams, and it is 2 all the time. It means the stream is actually deleted in this map(id->Stream).
Then I try to add close(recvNotifyCh) in cleanup function in stream.go. However, one error occurs: send on closed channel, because asyncNotify is called after the cleanup function.
The channels in Stream seem not to be moved by GC. And I'd like to know how to fix it? What's the reason? or there are some problems in my code, and how should I use libp2p correctly?
Thanks for your apply!
The text was updated successfully, but these errors were encountered:
The chan struct{} in Stream, such as recvNotifyCh, sendNotifyCh, readDeadline, writeDeadline, is never closed?
The problem is that: In server I call Host.NewStream (in go-libp2p-core) to get a stream, and write something to this stream, then close the stream. The client will receive this message and output it in the console, close too.
However, the memory continues growing, and I use pprof to test why this happens, and the memory occupied by the channels is large and still growing.
I try to output the size of session.streams, and it is 2 all the time. It means the stream is actually deleted in this map(id->Stream).
Then I try to add close(recvNotifyCh) in cleanup function in stream.go. However, one error occurs: send on closed channel, because asyncNotify is called after the cleanup function.
The channels in Stream seem not to be moved by GC. And I'd like to know how to fix it? What's the reason? or there are some problems in my code, and how should I use libp2p correctly?
Thanks for your apply!
The text was updated successfully, but these errors were encountered: