Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multiple routines use non-threadsafe cache #384

Closed
nikhilm opened this issue Dec 3, 2016 · 2 comments
Closed

Multiple routines use non-threadsafe cache #384

nikhilm opened this issue Dec 3, 2016 · 2 comments
Assignees
Milestone

Comments

@nikhilm
Copy link
Contributor

nikhilm commented Dec 3, 2016

Did I miss something?

route, ok := s.cacheget(appName, path)
is called from multiple handlers, but is not thread safe https://github.com/iron-io/functions/blob/a7a466f968006a0dc04668b44e4e04da5b942b46/api/server/internal/routecache/lru.go

@ucirello
Copy link
Contributor

ucirello commented Dec 3, 2016

Could you please double check? I am pretty confident we've have guarded the LRU cache with mutexes. Refer to

func (s *Server) cacheget(appname, path string) (*models.Route, bool) {

@ucirello ucirello added this to the Alpha 2 milestone Dec 3, 2016
@ucirello ucirello self-assigned this Dec 3, 2016
@nikhilm
Copy link
Contributor Author

nikhilm commented Dec 4, 2016

Guess you are right. Could use some refactoring to move the mutex into the cache. We already have well tested lrucache in some other code. Not urgent.

@nikhilm nikhilm closed this as completed Dec 4, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants