Giter VIP home page Giter VIP logo

go-sessions's Introduction

go-sessions's People

Contributors

dependabot[bot] avatar frankcai4real avatar ilyabrin avatar kataras avatar monoflash avatar rikvdh avatar trim21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sessions's Issues

cookie cannot work with domain "mysubsubdomain.mysubdomain.localhost.com"

in the sessions.go file ,the function updateCookie with sub code:

// RFC2109, we allow level 1 subdomains, but no further
			// if we have localhost.com , we want the localhost.cos.
			// so if we have something like: mysubdomain.localhost.com we want the localhost here
			// if we have mysubsubdomain.mysubdomain.localhost.com we want the .mysubdomain.localhost.com here
			// slow things here, especially the 'replace' but this is a good and understable( I hope) way to get the be able to set cookies from subdomains & domain with 1-level limit
			if dotIdx := strings.LastIndexByte(requestDomain, '.'); dotIdx > 0 {
				// is mysubdomain.localhost.com || mysubsubdomain.mysubdomain.localhost.com
				s := requestDomain[0:dotIdx] // set mysubdomain.localhost || mysubsubdomain.mysubdomain.localhost
				if secondDotIdx := strings.LastIndexByte(s, '.'); secondDotIdx > 0 {
					//is mysubdomain.localhost ||  mysubsubdomain.mysubdomain.localhost
					s = s[secondDotIdx+1:] // set to localhost || mysubdomain.localhost
				}
				// replace the s with the requestDomain before the domain's siffux
				subdomainSuff := strings.LastIndexByte(requestDomain, '.')
				if subdomainSuff > len(s) { // if it is actual exists as subdomain suffix
					requestDomain = strings.Replace(requestDomain, requestDomain[0:subdomainSuff], s, 1) // set to localhost.com || mysubdomain.localhost.com
				}
			}
			// finally set the .localhost.com (for(1-level) || .mysubdomain.localhost.com (for 2-level subdomain allow)
			cookie.Domain = "." + requestDomain // . to allow persistence

but , i found requestDomain with value "mysubsubdomain.mysubdomain.localhost.com" or "mysubdomain.localhost.com", all come out "localhost.com" ,not as the note says 。

Concurrent map read and map write

I wrote earlier that there is an error with simultaneous access to the map [] sessions in the memory. The error occurs when a very fast access to the server with a raised session.
Use sync.lock on the map (bad idea - not a fast access)
It is best to replace the map[] on the container/list

fatal error: concurrent map read and map write

goroutine 23 [running]:
runtime.throw(0x4d0960f, 0x21)
	/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc420e0b230 sp=0xc420e0b210
runtime.mapaccess2_faststr(0x4bde6e0, 0xc420898210, 0x4cebc85, 0x9, 0x43a2790, 0xc420776200)
	/usr/local/go/src/runtime/hashmap_fast.go:306 +0x52b fp=0xc420e0b290 sp=0xc420e0b230
vendor/github.com/kataras/go-sessions.(*session).Get(0xc420ef02a0, 0x4cebc85, 0x9, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:43 +0xb0 fp=0xc420e0b300 sp=0xc420e0b290
application/middlewares/minify.(*impl).Serve(0xc420dfe030, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/minify/minify.go:48 +0x114 fp=0xc420e0b4c0 sp=0xc420e0b300
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b4f0 sp=0xc420e0b4c0
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:45 +0x4aa fp=0xc420e0b620 sp=0xc420e0b4f0
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b650 sp=0xc420e0b620
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53 fp=0xc420e0b678 sp=0xc420e0b650
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30 fp=0xc420e0b690 sp=0xc420e0b678
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b6c0 sp=0xc420e0b690
application/routing.(*impl).LoggerHandlerFunc.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7 fp=0xc420e0b9d0 sp=0xc420e0b6c0
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30 fp=0xc420e0b9e8 sp=0xc420e0b9d0
vendor/github.com/kataras/iris.(*Context).Do(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59 fp=0xc420e0ba08 sp=0xc420e0b9e8
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0 fp=0xc420e0bc30 sp=0xc420e0ba08
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206ee900)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f fp=0xc420e0bc70 sp=0xc420e0bc30
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736 fp=0xc420e0be00 sp=0xc420e0bc70
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b fp=0xc420e0be50 sp=0xc420e0be00
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420eea060)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f fp=0xc420e0bf58 sp=0xc420e0be50
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420eea060, 0x4b7e840, 0xc420eea060)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35 fp=0xc420e0bf80 sp=0xc420e0bf58
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420e0bf88 sp=0xc420e0bf80
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc4208956c4)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*WaitGroup).Wait(0xc4208956b8)
	/usr/local/go/src/sync/waitgroup.go:131 +0x97
application/modules/worker.(*impl).Wait(0xc4208956b0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:247 +0x33
main.Main(0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:143 +0x1363
main.main()
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:33 +0x22

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 10 [runnable]:
regexp.(*inputString).step(0xc420884318, 0x0, 0xffffffff00000000, 0x1)
	/usr/local/go/src/regexp/regexp.go:291
regexp.(*machine).tryBacktrack(0xc420884240, 0xc420d5e060, 0x52c7140, 0xc420884318, 0x1, 0x0, 0xc420f1a000)
	/usr/local/go/src/regexp/backtrack.go:222 +0x73a
regexp.(*machine).backtrack(0xc420884240, 0x52c7140, 0xc420884318, 0x0, 0x3, 0x6, 0x40151ee)
	/usr/local/go/src/regexp/backtrack.go:356 +0x193
regexp.(*Regexp).doExecute(0xc42008e3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc420d1440c, 0x3, 0x0, 0x6, ...)
	/usr/local/go/src/regexp/exec.go:437 +0x2e5
regexp.(*Regexp).FindStringSubmatch(0xc42008e3c0, 0xc420d1440c, 0x3, 0xc420d14420, 0xc42007d600, 0x4)
	/usr/local/go/src/regexp/regexp.go:903 +0x9d
vendor/github.com/webdeskltd/log/formater.(*impl).TruncateString(0x533c2e8, 0xc420d14420, 0x4, 0xc420d1440c, 0x3, 0xc420d14420, 0x4)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:51 +0xee
vendor/github.com/webdeskltd/log/formater.(*impl).FormatedElement(0x533c2e8, 0xc420dca2a0, 0x5, 0x4b3391e, 0x1, 0x4b16e44, 0xb, 0x4b3390c, 0x5, 0xc420d1440c, ...)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:129 +0xd0d
vendor/github.com/webdeskltd/log/formater.(*impl).Text(0x533c2e8, 0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40, 0x4d1fabd, ...)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:222 +0x60d
vendor/github.com/webdeskltd/log.(*impl).DefaultReceiver(0xc4206e6230, 0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/essence.go:61 +0xab
vendor/github.com/webdeskltd/log.(*impl).DefaultReceiver-fm(0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/essence.go:28 +0x4c
vendor/github.com/webdeskltd/log/sender.(*impl).Receiver(0xc420012480)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/sender/sender.go:61 +0x2c3
created by vendor/github.com/webdeskltd/log/sender.init.1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/sender/sender.go:12 +0x5f

goroutine 11 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/go/src/runtime/sigqueue.go:116 +0x157
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.1
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 12 [sleep]:
time.Sleep(0x3b9aca00)
	/usr/local/go/src/runtime/time.go:59 +0xe1
vendor/github.com/valyala/fasthttp.init.1.func1()
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1372 +0x2e
created by vendor/github.com/valyala/fasthttp.init.1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1375 +0x3a

goroutine 21 [chan receive]:
database/sql.(*DB).connectionOpener(0xc420d70160)
	/usr/local/go/src/database/sql/sql.go:730 +0x4a
created by database/sql.Open
	/usr/local/go/src/database/sql/sql.go:493 +0x1e9

goroutine 14 [chan receive]:
vendor/github.com/geekypanda/httpcache.(*memoryStore).startGC.func1.1(0xc420018c00, 0xc4208cfef0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/geekypanda/httpcache/store.go:138 +0x8b
created by vendor/github.com/geekypanda/httpcache.(*memoryStore).startGC.func1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/geekypanda/httpcache/store.go:148 +0x6e

goroutine 16 [chan receive]:
vendor/github.com/kataras/iris.(*Framework).Serve(0xc420de6000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:457 +0x30d
application/webserver.(*impl).Serve(0xc420886000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/webserver/webserver.go:68 +0x56
application/workers/web.(*impl).Worker(0xc420895710, 0xc420cdd810, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/web/web.go:67 +0x367
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd810)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 50 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cdd8f0, 0x34630b8a000, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/filestore.(*impl).Worker(0x533c2e8, 0xc420cdd8f0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/filestore/filestore.go:42 +0x1fe
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd8f0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 51 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cdd9d0, 0xdf8475800, 0xc42002b700)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/session.(*impl).Worker(0x533c2e8, 0xc420cdd9d0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/session/session.go:64 +0x66
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd9d0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 52 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cddab0, 0x77359400, 0xc42002bf00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/cleaner.(*impl).Worker(0x533c2e8, 0xc420cddab0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/cleaner/cleaner.go:63 +0x5c
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cddab0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 66 [select]:
vendor/github.com/kataras/go-websocket.(*server).serve(0xc420de60a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-websocket/server.go:216 +0xeb3
created by vendor/github.com/kataras/go-websocket.(*server).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-websocket/server.go:211 +0x3f

goroutine 67 [sleep]:
time.Sleep(0x3b9aca00)
	/usr/local/go/src/runtime/time.go:59 +0xe1
main.Main.func3()
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:126 +0x33
created by main.Main
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:128 +0x1160

goroutine 68 [select, locked to thread]:
runtime.gopark(0x4d953a8, 0x0, 0x4ce85c6, 0x6, 0x18, 0x2)
	/usr/local/go/src/runtime/proc.go:259 +0x13a
runtime.selectgoImpl(0xc420ee8f30, 0x0, 0x18)
	/usr/local/go/src/runtime/select.go:423 +0x11d9
runtime.selectgo(0xc420ee8f30)
	/usr/local/go/src/runtime/select.go:238 +0x1c
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal1_unix.go:304 +0x2d1
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 69 [select]:
application/modules/interrupt.(*impl).Catcher(0xc420886c00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/interrupt/interrupt.go:71 +0x1d7
created by application/modules/interrupt.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/interrupt/interrupt.go:49 +0x3fb

goroutine 22 [IO wait]:
net.runtime_pollWait(0x60919c0, 0x72, 0x7)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420cae060, 0x72, 0xc420a998c0, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420cae060, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc420cae000, 0xc420de4000, 0x1fa0, 0x1fa0, 0x0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_unix.go:243 +0x1a1
net.(*conn).Read(0xc420ef6000, 0xc420de4000, 0x1fa0, 0x1fa0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/net.go:173 +0x70
bufio.(*Reader).fill(0xc420ef00c0)
	/usr/local/go/src/bufio/bufio.go:97 +0x10c
bufio.(*Reader).Peek(0xc420ef00c0, 0x1, 0xc4206ca820, 0xc420a99a20, 0x0, 0xc420cae000, 0x4059500)
	/usr/local/go/src/bufio/bufio.go:129 +0x62
vendor/github.com/valyala/fasthttp.(*RequestHeader).tryRead(0xc4208cc480, 0xc420ef00c0, 0x1, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1305 +0x79
vendor/github.com/valyala/fasthttp.(*RequestHeader).Read(0xc4208cc480, 0xc420ef00c0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1291 +0x62
vendor/github.com/valyala/fasthttp.(*Request).readLimitBody(0xc4208cc480, 0xc420ef00c0, 0x800000, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/http.go:869 +0x63
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420ef6000, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1479 +0x1253
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420ef6000, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df41a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df41a0, 0x4b7e840, 0xc420df41a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 54 [IO wait]:
net.runtime_pollWait(0x6091b40, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420cddbf0, 0x72, 0xc42003dac8, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420cddbf0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).accept(0xc420cddb90, 0x0, 0x52bb040, 0xc420df4220)
	/usr/local/go/src/net/fd_unix.go:419 +0x238
net.(*TCPListener).accept(0xc420ac65c0, 0x163, 0x162, 0xc42003dbc8)
	/usr/local/go/src/net/tcpsock_posix.go:132 +0x2e
net.(*TCPListener).AcceptTCP(0xc420ac65c0, 0x601b000, 0xc41ffca04e, 0xc42003dc68)
	/usr/local/go/src/net/tcpsock.go:209 +0x49
application/workers/web.TCPKeepAliveListener.Accept(0xc420ac65c0, 0x3, 0x0, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/web/keepalive.go:19 +0x80
application/workers/web.(*TCPKeepAliveListener).Accept(0xc420d14100, 0x0, 0x0, 0x0, 0x0)
	<autogenerated>:10 +0xaf
vendor/github.com/valyala/fasthttp.acceptConn(0xc4207b0000, 0x52c4540, 0xc420d14100, 0xc42003def8, 0x0, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1289 +0x80
vendor/github.com/valyala/fasthttp.(*Server).Serve(0xc4207b0000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1258 +0x2ae
vendor/github.com/kataras/iris.(*Framework).Serve.func2(0xc420de6000, 0x52c4540, 0xc420d14100)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:441 +0x45
created by vendor/github.com/kataras/iris.(*Framework).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:441 +0x1ad

goroutine 55 [chan send]:
vendor/github.com/kataras/iris.(*Framework).Serve.func3(0xc420de6000)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:454 +0x4c
created by vendor/github.com/kataras/iris.(*Framework).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:454 +0x220

goroutine 82 [sleep]:
time.Sleep(0x2540be400)
	/usr/local/go/src/runtime/time.go:59 +0xe1
vendor/github.com/valyala/fasthttp.(*workerPool).Start.func1(0xc4206bc080, 0xc420df63c0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:59 +0xb1
created by vendor/github.com/valyala/fasthttp.(*workerPool).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:62 +0x103

goroutine 83 [semacquire]:
sync.runtime_Semacquire(0xc420ef02bc)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc420ef02b8)
	/usr/local/go/src/sync/mutex.go:85 +0xd0
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420a9a240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:87 +0x37
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206efb00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420ef6008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420ef6008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a020)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a020, 0x4b7e840, 0xc420d0a020)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 56 [runnable]:
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x12a
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4208cc900)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420b12028, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420b12028, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df4240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df4240, 0x4b7e840, 0xc420df4240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 24 [runnable]:
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420b142b0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:88 +0x93
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206ef200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe050, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe050, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a420)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a420, 0x4b7e840, 0xc420d0a420)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 25 [IO wait]:
net.runtime_pollWait(0x6091600, 0x72, 0xd)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420c8c4c0, 0x72, 0xc420a958c0, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420c8c4c0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc420c8c460, 0xc420e00000, 0x1fa0, 0x1fa0, 0x0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_unix.go:243 +0x1a1
net.(*conn).Read(0xc420dfe058, 0xc420e00000, 0x1fa0, 0x1fa0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/net.go:173 +0x70
bufio.(*Reader).fill(0xc420018360)
	/usr/local/go/src/bufio/bufio.go:97 +0x10c
bufio.(*Reader).Peek(0xc420018360, 0x1, 0x4037e58, 0xc42001c00c, 0x300000002, 0xc42008d860, 0x11)
	/usr/local/go/src/bufio/bufio.go:129 +0x62
vendor/github.com/valyala/fasthttp.(*RequestHeader).tryRead(0xc420cd6000, 0xc420018360, 0x1, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1305 +0x79
vendor/github.com/valyala/fasthttp.(*RequestHeader).Read(0xc420cd6000, 0xc420018360, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1291 +0x62
vendor/github.com/valyala/fasthttp.(*Request).readLimitBody(0xc420cd6000, 0xc420018360, 0x800000, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/http.go:869 +0x63
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe058, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1479 +0x1253
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe058, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a460)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a460, 0x4b7e840, 0xc420d0a460)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 57 [semacquire]:
sync.runtime_Semacquire(0xc420ef02bc)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc420ef02b8)
	/usr/local/go/src/sync/mutex.go:85 +0xd0
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420a9a280)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:87 +0x37
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4208ccd80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420e3c008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420e3c008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df41e0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df41e0, 0x4b7e840, 0xc420df41e0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb
make: *** [dev] Error 2

session is abnormal

Why does this happen?

TXJ0QVRSdE94cEZ6V1BLU1pIUGp4S0pGcWRPd0VRaEw%252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525253D

Cannot get latest version: module contains a go.mod file, so module path should be github.com/kataras/go-sessions/v3

Background

The github.com/kataras/go-sessions uses Go modules and the current release version is v3. And it’s module path is "github.com/kataras/go-sessions", instead of "github.com/kataras/go-sessions/v3". It must comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation. Quoting the specification:

A package that has opted in to modules must include the major version in the import path to import any v2+ modules
To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element. For example, version v2.0.0 of example.com/m must instead use module path example.com/m/v2.
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

Steps to Reproduce

GO111MODULE=on, run go get targeting any version >= v3.1.0 of the kataras/go-sessions:

$ go get github.com/kataras/[email protected]
go: finding github.com/kataras/go-sessions v3.1.0
go: finding github.com/kataras/go-sessions v3.1.0
go get github.com/kataras/[email protected]: github.com/kataras/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

run go get github.com/kataras/go-sessions, the version will stuck in v3.0.0:

$go get github.com/kataras/go-sessions
go: downloading github.com/kataras/go-sessions v0.0.7
go: downloading github.com/kataras/go-sessions v3.0.0+incompatible
go: github.com/kataras/go-sessions upgrade => v3.0.0+incompatible 

SO anyone using Go modules will not be able to easily use any newer version of kataras/go-sessions.

Solution

1. Kill the go.mod files, rolling back to GOPATH.

This would push them back to not being managed by Go modules (instead of incorrectly using Go modules).
Ensure compatibility for downstream module-aware projects and module-unaware projects projects

2. Fix module path to strictly follow SIV rules.

Patch the go.mod file to declare the module path as github.com/kataras/go-sessions/v3 as per the specs. And adjust all internal imports.
The downstream projects might be negatively affected in their building if they are module-unaware (Go versions older than 1.9.7 and 1.10.3; Or use third-party dependency management tools, such as: Dep, glide,govendor…).

[*] You can see who will be affected here: [17 module-unaware users, i.e., ttstringiot/golangiot, wjl2017/ttstringgolangiot, qnib/jupyterport ]
https://github.com/search?q=kataras%2Fgo-sessions+filename%3Avendor.conf+filename%3Avendor.json+filename%3Aglide.toml+filename%3AGodep.toml&type=Code

If you don't want to break the above repos. This method can provides better backwards-compatibility.
Release a v2 or higher module through the major subdirectory strategy: Create a new v3 subdirectory (github.com/kataras/go-sessions/v3) and place a new go.mod file in that subdirectory. The module path must end with /v3. Copy or move the code into the v3 subdirectory. Update import statements within the module to also use /v3 (import "github.com/kataras/go-sessions/v3/…"). Tag the release with v3.x.y.

3. Suggest your downstream module users use hash instead of a version tag.

If the standard rule of go modules conflicts with your development mode. Or not intended to be used as a library and does not make any guarantees about the API. So you can’t comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation.
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of go get github.com/kataras/go-sessions@version-tag, module users need to use this following way to get the kataras/go-sessions:
(1) Search for the tag you want (in browser)
(2) Get the commit hash for the tag you want
(3) Run go get github.com/kataras/go-sessions@commit-hash
(4) Edit the go.mod file to put a comment about which version you actually used
This will make it difficult for module users to get and upgrade kataras/go-sessions.

[*] You can see who will be affected here: [12 module users, e.g., AlexSwiss/go-login, dickyaryag6/Mini-e-wallet-using-GO, juliaveronica02/whatsapp-go]
https://github.com/search?o=desc&q=kataras%2Fgo-sessions+filename%3Ago.mod&s=indexed&type=Code

Summary

You can make a choice to fix DM issues by balancing your own development schedules/mode against the affects on the downstream projects.

For this issue, Solution 1 can maximize your benefits and with minimal impacts to your downstream projects the ecosystem.

References

Only set cookie if there is a session?

Hi, is there any way of setting the cookie to be set on the browser manually rather than with every request?

ie only if there is a value in session or once a route is requested?

Thanks

Flaw in redis backend architecture

In recent redis backend update it seems like session fields are stored as a individual key value pair where value is a JSON encoded bydefault (default encode/decoder) and are namespaced as sessionid_fieldname.

Methods like Clear uses redis SCAN with count 9999999999 to find all the fields and clear it but this is a bad approach since redis SCAN is a blocking command and in a system with reasonable number of session keys blocking time is considerably high. I have tested this by inserting few million fake session keys in redis and called Clear method which took several seconds to return.

I think the better approach is to use redis hashmap for storing session. Session fields will be individual keys in the map and values are encoded with default encoder. Clear method can just delete the hashmap to clear the session in backend instead of iterating over keys. Performance of GetAll method all will be improved by redis HGETALL command which returns all the keys for given session id.

I can send a PR to address the above issue. Please let me know what you think.

incompatible go mod with uuid package

/pkg/mod/github.com/kataras/[email protected]+incompatible/config.go:127:10: assignment mismatch: 2 variables but uuid.NewV4 returns 1 values

github.com/satori/go.uuid v1.2.0 // indirect
github.com/kataras/go-sessions v3.0.0+incompatible

The SetFlash() function does not work

I use the redis storage engine, and execute SetFlash("test", "ok"), but I have not seen in the redis cookie and write the value, use GetFlashString("test") also does not read the value.

Run into panic:runtime error when trying to test sessions example code with ApacheBench

Get panic error like this when trying to test sessions code example by Apache Bench with command like ab -n 10000 -c 10 http://127.0.0.1:8080/get .

  • Iris Version: v4-LTS
  • go-session version: v0.0.6

Could anyone reproduce this? Is this a bug?

Session example code like this copied from here

package main

import "gopkg.in/kataras/iris.v4"

func main() {
	iris.Get("/", func(c *iris.Context) {
		c.Write("You should navigate to the /set, /get, /delete, /clear,/destroy instead")
	})

	iris.Get("/set", func(c *iris.Context) {

		//set session values
		c.Session().Set("name", "iris")

		//test if setted here
		c.Write("All ok session setted to: %s", c.Session().GetString("name"))
	})

	iris.Get("/get", func(c *iris.Context) {
		// get a specific key as a string.
		// returns an empty string if the key was not found.
		name := c.Session().GetString("name")

		c.Write("The name on the /set was: %s", name)
	})

	iris.Get("/delete", func(c *iris.Context) {
		// delete a specific key
		c.Session().Delete("name")
	})

	iris.Get("/clear", func(c *iris.Context) {
		// removes all entries
		c.Session().Clear()
	})

	iris.Get("/destroy", func(c *iris.Context) {
		// destroy/removes the entire session and cookie
		c.SessionDestroy()
		c.Log("You have to refresh the page to completely remove the session (on browsers), so the name should NOT be empty NOW, is it?\n ame: %s\n\nAlso check your cookies in your browser's cookies, should be no field for localhost/127.0.0.1 (or whatever you use)", c.Session().GetString("name"))
		c.Write("You have to refresh the page to completely remove the session (on browsers), so the name should NOT be empty NOW, is it?\nName: %s\n\nAlso check your cookies in your browser's cookies, should be no field for localhost/127.0.0.1 (or whatever you use)", c.Session().GetString("name"))
	})

	iris.Listen(":8080")
}

Error Info:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6f4cdd]
goroutine 35 [running]:
panic(0x9cdc00, 0xc42000c140)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
container/list.(*List).PushBack(0xc42017fbf0, 0xa41220, 0xc42042fe00, 0xc42042fe00)
        /usr/local/go/src/container/list/list.go:139 +0xdd
gopkg.in/kataras/go-sessions%2ev0.(*Provider).Init(0xc42017fc50, 0xc420015770, 0x2c, 0x68c61714000, 0x0, 0x8)
        /home/szp/gowp/src/gopkg.in/kataras/go-sessions.v0/provider.go:74 +0x9b
gopkg.in/kataras/go-sessions%2ev0.(*sessions).StartFasthttp(0xc4201d7380, 0xc420274000, 0x4, 0x4)
        /home/szp/gowp/src/gopkg.in/kataras/go-sessions.v0/sessions.go:212 +0xc0
gopkg.in/kataras/iris%2ev4.(*Context).Session(0xc420438940, 0x464a1d, 0xc42000c129)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/context.go:1102 +0x6e
main.main.func3(0xc420438940)
        /home/szp/gowp/src/sessionTest/sessions.go:53 +0x2f
gopkg.in/kataras/iris%2ev4.HandlerFunc.Serve(0xacba98, 0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/http.go:245 +0x30
gopkg.in/kataras/iris%2ev4.(*Context).Do(0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/context.go:117 +0x49
gopkg.in/kataras/iris%2ev4.(*serveMux).BuildHandler.func1(0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/http.go:1092 +0x88b
gopkg.in/kataras/iris%2ev4.(*Framework).Build.func1.1(0xc420274000)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/iris.go:367 +0x5a
github.com/valyala/fasthttp.(*Server).serveConn(0xc4202168c0, 0xd498e0, 0xc4202b0018, 0xc420252001, 0xc420250101)
        /home/szp/gowp/src/github.com/valyala/fasthttp/server.go:1536 +0x573
github.com/valyala/fasthttp.(*Server).(github.com/valyala/fasthttp.serveConn)-fm(0xd498e0, 0xc4202b0018, 0xc420041f48, 0x1)
        /home/szp/gowp/src/github.com/valyala/fasthttp/server.go:1250 +0x3e
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc420252000, 0xc42025e120)
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:210 +0xde
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc420252000, 0xc42025e120, 0x97dc00, 0xc42025e120)
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:184 +0x111

use redis and restart server

[ERRO] 2017/09/30 13:26 error while trying to load session values(1027f009-8996-47b0-bb21-fd090e07c265) from redis:
the retrieved value is not a sessions.RemoteStore type, please report that as bug, it should never occur

Database interface should accept context.Context for all methods

The Database interface should be duplicated and modified (e.g. DatabaseWithCtx) to support receiving the request context for each method call.

For example:

type Database interface {
	Acquire(sid string, expires time.Duration) LifeTime
	// ...
}

// Should become this ↓
type DatabaseWithCtx interface {
	Acquire(ctx context.Context, sid string, expires time.Duration) LifeTime
	// ...
}

This is important for things like tracing, logging, etc...

unknown field 'DecodeCookie' in struct literal of type sessions.Config

why no field DecodeCookie, I can find it in config.go
my code is
sess := sessions.New(sessions.Config{
Cookie: model.Cfg.CookieName,
//DecodeCookie: false,
Expires: time.Duration(model.Cfg.CookieDuration),
CookieLength: 32,
DisableSubdomainPersistence: false,
)}
I commet the DecodeCookie field line,then pass build

Provide option to always load sessions from database

Hi
Thanks for your work on this library, @kataras .

This is regarding the in-memory session state stored by this library(after the first Start()).

Many multi-process/multi-node app setups share a common backend database to persist sessions. Only loading the sessions for the first time into memory leads to inconsistent state across multiple instances of the application. This request has been raised few times already by users of this library(or its fork in Iris framework): #12 , kataras/iris#885 .

The proposal is to add a Config flag(defaults to false) to enable always looking up the session in the backend database. This way, users that have multiple instances sharing the same database can still have consistent state across instances without disturbing the current in-memory behaviour.

This being a standalone sessions library(not tied to any framework) should definitely have a way to use the library in a multi-machine with common backend setup as most users would expect the library to have consistent state in such situations. Here's an easy fix for this issue. Your thoughts?

Why need this section?

Maybe I'm say false but I really don't understand why only localhost addresses? Maybe need full check all addresses IPv4?

@

// for these type of hosts, we can't allow subdomains persistence,

unable to get int from boltdb database

when setting int to boltdb/badger backend, it will be decoded to float64, so there is no way to call GetInt get correct value when using boltdb as database

should use gob as default encoding and decoding?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.