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

setting expiration fails #20

Closed
yeongjukang opened this issue Apr 29, 2020 · 4 comments
Closed

setting expiration fails #20

yeongjukang opened this issue Apr 29, 2020 · 4 comments

Comments

@yeongjukang
Copy link

Hi I found an error at 'Save' method of 'session.go while I was using this package'.
I added log.Println and panic like code below and got log below.
It is also happens when I use 'memory' as provider. I think tinylib/msgp should be ready for time.Duration treating it as int64 or session to use int64 instead of time.Duration.

I think returning nil when there is an error is inappropriate too. '30s setting' didn't work every time and '2hours' was returned constantly and it made me to take some time to find out like this.

Thank you for such a nice library.

data, err := s.config.EncodeFunc(store.GetAll())
	if err != nil {
		log.Println(err)
		panic(err)
		return nil
	}

2020/04/29 20:16:25 Starting example with provider: mysql
2020/04/29 20:16:25 Session example server listen: http://0.0.0.0:8086
2020/04/29 20:16:32 msgp: type "time.Duration" not supported at D/0/Value
panic: msgp: type "time.Duration" not supported at D/0/Value

goroutine 22 [running]:
github.com/fasthttp/session/v2.(*Session).Save(0xc000286000, 0xc0002b8000, 0xc00021a080, 0x0, 0x0)
/home/yeongju/go/pkg/mod/github.com/fasthttp/session/v2@v2.0.1/session.go:191 +0x369
main.setExpirationHandler(0xc0002b8000)
/home/yeongju/go/src/github.com/979156/shrello/handler.go:190 +0x15d
github.com/fasthttp/router.(*Router).Handler(0xc0001e0180, 0xc0002b8000)
/home/yeongju/go/pkg/mod/github.com/fasthttp/router@v1.0.4/router.go:443 +0xefd
github.com/valyala/fasthttp.(*Server).serveConn(0xc00029a000, 0x849840, 0xc0001ee060, 0x0, 0x0)
/home/yeongju/go/pkg/mod/github.com/valyala/fasthttp@v1.12.0/server.go:2087 +0x567
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0002ac000, 0xc000282080)
/home/yeongju/go/pkg/mod/github.com/valyala/fasthttp@v1.12.0/workerpool.go:223 +0xc0
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0002ac000, 0xc000282080, 0x73b200, 0xc000282080)
/home/yeongju/go/pkg/mod/github.com/valyala/fasthttp@v1.12.0/workerpool.go:195 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
/home/yeongju/go/pkg/mod/github.com/valyala/fasthttp@v1.12.0/workerpool.go:194 +0x101

@yeongjukang
Copy link
Author

@savsgio

@savsgio
Copy link
Member

savsgio commented Apr 29, 2020

Hi @979156,

I've found the error. Tomorrow I will fix it.

About the not return the error, it was my mistake, maybe I didn't see that when I refactored the code.

Thanks you!

savsgio pushed a commit that referenced this issue Apr 29, 2020
@savsgio
Copy link
Member

savsgio commented Apr 29, 2020

Fixed! 🎉

@savsgio savsgio closed this as completed Apr 29, 2020
@yeongjukang
Copy link
Author

@savsgio Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants