Hello, I have this function served via swagger
func ScanQr(params profile.ScanQrParams) middleware.Responder {
qr := make(chan string)
errCh := make(chan error)
go func() {
sessionID := params.SessionID.String()
handler, err := wa.Login(qr, params.ProxyURL, sessionID)
if err != nil {
errCh <- err
}
wa.Connections[sessionID] = handler
}()
select {
case err := <-errCh:
errText := err.Error()
return profile.NewScanQrDefault(500).WithPayload(&models.Error{
Code: 500,
Message: &errText,
})
case qrText := <-qr:
return profile.NewScanQrOK().WithPayload(&models.QRCode{
Base64: qrText,
})
}
}
I tried to flood the function with 50 requests to understand what will be going on if we have 50 users online asking for the QR... Well, i got a server panic a VERY LONG error but I will add the deader of the error.
runtime: out of memory: cannot allocate 26214400-byte block (3927212032 in use)
fatal error: out of memory
runtime stack:
runtime.throw(0x87ae49f, 0xd)
/usr/local/go/src/runtime/panic.go:774 +0x6a
runtime.largeAlloc(0x1900000, 0x8090101, 0xe740ed20)
/usr/local/go/src/runtime/malloc.go:1140 +0x108
runtime.mallocgc.func1()
/usr/local/go/src/runtime/malloc.go:1033 +0x39
runtime.systemstack(0x9588700)
/usr/local/go/src/runtime/asm_386.s:399 +0x53
runtime.mstart()
/usr/local/go/src/runtime/proc.go:1146
goroutine 2083 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_386.s:360 fp=0x9c1397c sp=0x9c13978 pc=0x8098d00
runtime.mallocgc(0x1900000, 0x86dc340, 0x87ef801, 0x84cc9a40)
/usr/local/go/src/runtime/malloc.go:1032 +0x6a8 fp=0x9c139d0 sp=0x9c1397c pc=0x8052508
runtime.makeslice(0x86dc340, 0x1900000, 0x1900000, 0xe74b9cb8)
/usr/local/go/src/runtime/slice.go:49 +0x4f fp=0x9c139e4 sp=0x9c139d0 pc=0x8085acf
bufio.NewReaderSize(...)
/usr/local/go/src/bufio/bufio.go:56
github.com/gorilla/websocket.newConn(0x88e4140, 0x1232000, 0x0, 0x1900000, 0xa00000, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:293 +0x2e1 fp=0x9c13a4c sp=0x9c139e4 pc=0x85a56d1
github.com/gorilla/websocket.(*Dialer).DialContext(0x950c340, 0x88df800, 0x950cfc0, 0x87b9975, 0x19, 0x8d96fc68, 0x0, 0x0, 0x0, 0x0)
/root/go/pkg/mod/github.com/gorilla/[email protected]/client.go:327 +0xc6f fp=0x9c13be4 sp=0x9c13a4c pc=0x85a2def
github.com/gorilla/websocket.(*Dialer).Dial(0x950c340, 0x87b9975, 0x19, 0x8d96fc68, 0x8d96fccc, 0x84dc65e, 0x0, 0x0)
/root/go/pkg/mod/github.com/gorilla/[email protected]/client.go:106 +0x4d fp=0x9c13c10 sp=0x9c13be4 pc=0x85a1fad
github.com/Rhymen/go-whatsapp.(*Conn).connect(0x9a253b0, 0x0, 0x0)
/root/go/pkg/mod/github.com/!rhymen/[email protected]/conn.go:163 +0x1a1 fp=0x9c13d34 sp=0x9c13c10 pc=0x85b8601
github.com/Rhymen/go-whatsapp.NewConn(0xf8475800, 0xd, 0x87bc8dd, 0x1d, 0x121cdb8)
/root/go/pkg/mod/github.com/!rhymen/[email protected]/conn.go:125 +0x119 fp=0x9c13d5c sp=0x9c13d34 pc=0x85b8229
bitbucket.org/rockyOO7/wa-api/whatsapp.NewConn(0x0, 0x98ff6f8, 0x0, 0x0)
/home/beshoo/go-wapi/wa/whatsapp/main.go:164 +0x1b8 fp=0x9c13dcc sp=0x9c13d5c pc=0x8606438
bitbucket.org/rockyOO7/wa-api/whatsapp.Login(0x19223580, 0x0, 0x97f0f90, 0x24, 0x807903e, 0x87ef7e8, 0x1)
/home/beshoo/go-wapi/wa/whatsapp/main.go:182 +0x7d fp=0x9c13fac sp=0x9c13dcc pc=0x86064cd
bitbucket.org/rockyOO7/wa-api/api.ScanQr.func1(0xd177aa00, 0x0, 0x97f0f90, 0x24, 0x19223580, 0x192235c0)
/home/beshoo/go-wapi/wa/api/profile.go:24 +0x4d fp=0x9c13fd8 sp=0x9c13fac pc=0x861cdad
Now let us see what is going on, on the main.go:164*
func NewConn(proxyURLString *string) (*wa.Conn, error) {
var err error
var wac *wa.Conn
var timeout = time.Duration(*timeoutInt) * time.Second
log.Infof("TimeOutFlag: %v , TimeOut: %v", *timeoutInt,timeout)
if proxyURLString != nil {
proxyURL, err := url.Parse(*proxyURLString)
if err != nil {
return nil, err
}
proxy := http.ProxyURL(proxyURL)
wac, err = wa.NewConnWithProxy(timeout, proxy)
} else {
wac, err = wa.NewConn(timeout) //<========== main.go:164
}
if err != nil {
wac.Disconnect()
return nil, err
}
return wac, nil
}
and profile.go:24
func ScanQr(params profile.ScanQrParams) middleware.Responder {
qr := make(chan string)
errCh := make(chan error)
go func() {
sessionID := params.SessionID.String()
handler, err := wa.Login(qr, params.ProxyURL, sessionID) // <<========= profile.go:24
if err != nil {
errCh <- err
}
wa.Connections[sessionID] = handler
}()
select {
case err := <-errCh:
errText := err.Error()
return profile.NewScanQrDefault(500).WithPayload(&models.Error{
Code: 500,
Message: &errText,
})
case qrText := <-qr:
return profile.NewScanQrOK().WithPayload(&models.QRCode{
Base64: qrText,
})
}
}
and the Login function which triggered by the QR scaner profile.go:24
func Login(qr chan string, proxyURL *strfmt.URI, sessionID string) (*WaHandler, error) {
var proxyURLString *string
if proxyURL != nil {
temp := proxyURL.String()
proxyURLString = &temp
}
var wac, err = NewConn(proxyURLString) // <=========== main.go:182
if err != nil {
return nil, err
}
.....................
}
Well, how can we handle suchtype of memory problem?
@x00b @Rhymen Any Ideas :)
Well I add the following function in the main
func PrintMemUsage() {
var m runtime.MemStats
runtime.ReadMemStats(&m)
// For info on each, see: https://golang.org/pkg/runtime/#MemStats
fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc))
fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc))
fmt.Printf("\tSys = %v MiB", bToMb(m.Sys))
fmt.Printf("\tNumGC = %v\n", m.NumGC)
}
func bToMb(b uint64) uint64 {
return b / 1024 / 1024
}
Please check the following
Each time i scan the QR i have increase in the allocated memory
Alloc = 178 MiB TotalAlloc = 195 MiB Sys = 203 MiB NumGC = 11
INFO[0079] Url /api/profile/scanqr
INFO[0079] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 213 MiB TotalAlloc = 230 MiB Sys = 245 MiB NumGC = 11
INFO[0085] Url /api/profile/scanqr
INFO[0085] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 249 MiB TotalAlloc = 265 MiB Sys = 275 MiB NumGC = 11
INFO[0092] Url /api/profile/scanqr
INFO[0092] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 283 MiB TotalAlloc = 300 MiB Sys = 317 MiB NumGC = 12
INFO[0093] Url /api/profile/scanqr
INFO[0093] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 318 MiB TotalAlloc = 335 MiB Sys = 360 MiB NumGC = 12
INFO[0094] Url /api/profile/scanqr
INFO[0094] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 354 MiB TotalAlloc = 370 MiB Sys = 390 MiB NumGC = 12
INFO[0095] Url /api/profile/scanqr
INFO[0095] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 389 MiB TotalAlloc = 406 MiB Sys = 432 MiB NumGC = 12
INFO[0096] Url /api/profile/scanqr
INFO[0096] TimeOutFlag: 59 , TimeOut: 59s
I believe we have to free memory after each request, what is the best way to do this?
I am not sure if this related to https://github.com/Rhymen/go-whatsapp/issues/328
Yes, the library has a lot of memory usage issues. If you can try changing de ws Dialer size to zero following #282 and send the allocated memory monitoring that you are doing so we can see if it improves.
I am not sure what shoud i do since there is no instruction in https://github.com/Rhymen/go-whatsapp/issues/282
Try following this: https://github.com/x00b/go-whatsapp/blob/testing/conn.go#L158
Try following this: https://github.com/x00b/go-whatsapp/blob/testing/conn.go#L158
Great, it should be added NOW to the LIB
See the great results:
Alloc = 5 MiB TotalAlloc = 19 MiB Sys = 15 MiB NumGC = 7
INFO[0034] Url /api/profile/scanqr
INFO[0034] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 19 MiB Sys = 15 MiB NumGC = 7
INFO[0042] Url /api/profile/scanqr
INFO[0042] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 19 MiB Sys = 15 MiB NumGC = 7
INFO[0046] Url /api/profile/scanqr
INFO[0046] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 19 MiB Sys = 15 MiB NumGC = 7
INFO[0048] Url /api/profile/scanqr
INFO[0048] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 19 MiB Sys = 15 MiB NumGC = 7
INFO[0049] Url /api/profile/scanqr
INFO[0049] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 7
INFO[0051] Url /api/profile/scanqr
INFO[0051] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 3 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0053] Url /api/profile/scanqr
INFO[0053] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 3 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0087] Url /api/profile/scanqr
INFO[0087] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0087] Url /api/profile/scanqr
INFO[0087] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0087] Url /api/profile/scanqr
INFO[0087] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0088] Url /api/profile/scanqr
INFO[0088] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 20 MiB Sys = 15 MiB NumGC = 8
INFO[0088] Url /api/profile/scanqr
INFO[0088] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0088] Url /api/profile/scanqr
INFO[0088] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0089] Url /api/profile/scanqr
INFO[0089] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0089] Url /api/profile/scanqr
INFO[0089] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0089] Url /api/profile/scanqr
INFO[0089] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0090] Url /api/profile/scanqr
INFO[0090] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0090] Url /api/profile/scanqr
INFO[0090] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0090] Url /api/profile/scanqr
INFO[0090] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 21 MiB Sys = 15 MiB NumGC = 8
INFO[0090] Url /api/profile/scanqr
INFO[0090] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0091] Url /api/profile/scanqr
INFO[0091] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0091] Url /api/profile/scanqr
INFO[0091] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0091] Url /api/profile/scanqr
INFO[0091] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0092] Url /api/profile/scanqr
INFO[0092] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0092] Url /api/profile/scanqr
INFO[0092] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0092] Url /api/profile/scanqr
INFO[0092] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0093] Url /api/profile/scanqr
INFO[0093] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 22 MiB Sys = 15 MiB NumGC = 8
INFO[0093] Url /api/profile/scanqr
INFO[0093] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 8
INFO[0093] Url /api/profile/scanqr
INFO[0093] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 8
INFO[0093] Url /api/profile/scanqr
INFO[0093] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 9
INFO[0094] Url /api/profile/scanqr
INFO[0094] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 9
INFO[0094] Url /api/profile/scanqr
INFO[0094] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 4 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 9
INFO[0094] Url /api/profile/scanqr
INFO[0094] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 9
INFO[0094] Url /api/profile/scanqr
INFO[0094] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 23 MiB Sys = 15 MiB NumGC = 9
INFO[0095] Url /api/profile/scanqr
INFO[0095] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0095] Url /api/profile/scanqr
INFO[0095] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0095] Url /api/profile/scanqr
INFO[0095] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0096] Url /api/profile/scanqr
INFO[0096] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0096] Url /api/profile/scanqr
INFO[0096] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0096] Url /api/profile/scanqr
INFO[0096] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0096] Url /api/profile/scanqr
INFO[0096] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 24 MiB Sys = 15 MiB NumGC = 9
INFO[0097] Url /api/profile/scanqr
INFO[0097] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0097] Url /api/profile/scanqr
INFO[0097] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0097] Url /api/profile/scanqr
INFO[0097] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0097] Url /api/profile/scanqr
INFO[0097] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0098] Url /api/profile/scanqr
INFO[0098] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0098] Url /api/profile/scanqr
INFO[0098] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0098] Url /api/profile/scanqr
INFO[0098] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0099] Url /api/profile/scanqr
INFO[0099] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 25 MiB Sys = 15 MiB NumGC = 9
INFO[0099] Url /api/profile/scanqr
INFO[0099] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0099] Url /api/profile/scanqr
INFO[0099] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0099] Url /api/profile/scanqr
INFO[0099] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0100] Url /api/profile/scanqr
INFO[0100] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0100] Url /api/profile/scanqr
INFO[0100] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0100] Url /api/profile/scanqr
INFO[0100] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0100] Url /api/profile/scanqr
INFO[0100] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 26 MiB Sys = 15 MiB NumGC = 9
INFO[0101] Url /api/profile/scanqr
INFO[0101] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 9
INFO[0101] Url /api/profile/scanqr
INFO[0101] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 9
INFO[0101] Url /api/profile/scanqr
INFO[0101] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0101] Url /api/profile/scanqr
INFO[0101] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0102] Url /api/profile/scanqr
INFO[0102] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 5 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0102] Url /api/profile/scanqr
INFO[0102] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0102] Url /api/profile/scanqr
INFO[0102] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0102] Url /api/profile/scanqr
INFO[0102] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 27 MiB Sys = 19 MiB NumGC = 10
INFO[0103] Url /api/profile/scanqr
INFO[0103] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0103] Url /api/profile/scanqr
INFO[0103] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0103] Url /api/profile/scanqr
INFO[0103] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0103] Url /api/profile/scanqr
INFO[0103] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0104] Url /api/profile/scanqr
INFO[0104] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 6 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0104] Url /api/profile/scanqr
INFO[0104] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0104] Url /api/profile/scanqr
INFO[0104] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 28 MiB Sys = 19 MiB NumGC = 10
INFO[0105] Url /api/profile/scanqr
INFO[0105] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0105] Url /api/profile/scanqr
INFO[0105] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0105] Url /api/profile/scanqr
INFO[0105] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0106] Url /api/profile/scanqr
INFO[0106] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0106] Url /api/profile/scanqr
INFO[0106] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 7 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0106] Url /api/profile/scanqr
INFO[0106] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0106] Url /api/profile/scanqr
INFO[0106] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0107] Url /api/profile/scanqr
INFO[0107] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 29 MiB Sys = 19 MiB NumGC = 10
INFO[0107] Url /api/profile/scanqr
INFO[0107] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 30 MiB Sys = 19 MiB NumGC = 10
INFO[0107] Url /api/profile/scanqr
INFO[0107] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 30 MiB Sys = 19 MiB NumGC = 10
INFO[0108] Url /api/profile/scanqr
INFO[0108] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 30 MiB Sys = 19 MiB NumGC = 10
INFO[0108] Url /api/profile/scanqr
INFO[0108] TimeOutFlag: 59 , TimeOut: 59s
Alloc = 8 MiB TotalAlloc = 30 MiB Sys = 19 MiB NumGC = 10
INFO[0109] Url /api/profile/scanqr
INFO[0109] TimeOutFlag: 59 , TimeOut: 59s
Ok, we should test it a little bit more before opening a PR, like Send messages, receiving too. But glad too know it might fix the memory issue!
@x00b but I am not sure if it will cause a problems, let me see on long terms if there is any panic! but definitely it makes a great difference!
Thank you so much.
@x00b , I made a super-strong benchmark to the lib, more than 300 QR request within 30 sec, now I will test sending messages - downloading files I will report to you with the memory status!
@x00b Well, I am trying to benchmark on of my numbers to see how much memory it takes.
but while testing I note this message
message sending responded with %!d(float64=400)
I am sending a broadcast to 2 numbers!
I am also testing here and things are going just fine. Receiving text, image and document. Also sending text, image and document.
ps: Try setting client version for the latest one, which is 2.2017.6
As i know the latest client is "10.15.14"
Are you sure about the 2.2017.6?
But in general l +1 to make PR, it is definitely improve the stability
As i know the latest client is "10.15.14"
Are you sure about the 2.2017.6?
10.15.14 is just your OS version, it could be anything. The current WA Web version (set in wac.SetClientVersion) is 2.2017.6.
As i know the latest client is "10.15.14"
Are you sure about the 2.2017.6?10.15.14 is just your OS version. The current WA Web version is 2.2017.6.
Which has to be set to
https://github.com/Rhymen/go-whatsapp/blob/5e33cb4ac5513dfae77f487f67e7e4c42bf20171/conn.go#L140
Correct.?
No, i am saying the WA Version with wac.SetClientVersion(2, 2017, 6)
I will keep testing it for the next days but it seems to low memory usage as you analyzed and if so, #354 might fix it :+1:
Most helpful comment
No, i am saying the WA Version with
wac.SetClientVersion(2, 2017, 6)