Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

shayonj/i18n-test-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I18nTestRepro

This repo exists to show how I18n.locale can leak between requests via the usage of Thread Local Storage(TLS), a.k.a Thread.current.

To replicate, have two tabs open (this may take a few retries)

  • bundle install
  • rails s (This application runs Puma with max 5 threads.)
  • On one tab open (Tab1) open http://localhost:3000?locale=es
    • Only MainController#index sets I18n.locale to params[:locale] if present one or I18n.default_locale
  • On another tab (Tab2) open http://localhost:3000/foo
    • This controller action is not tampering with I18n.locale and expects it to return en (the default locale)
  • Now, try to refresh both tabs as simultaneously/quickly as possible (simulating a high concurrency env).
  • Eventually notice, on Tab2 the current locale being rendered is no longer en but es

Here is a screen capture demonstrating the above: https://www.dropbox.com/s/zbogg3vag5at98b/i18n-locale-leak.mov?dl=0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published