Static GitHub Issues

[695] Middleware failing on concurrent requests

prev: 中文官网进不去
next: Using fuse-box instead of webpack?

I have a middleware that sets translations for my pages with the use of store, and a plugin that pulls them out to the templates. It's based on an older example of a i18n plugin. I haven't tried using the new vue-i18n integration, because I want to load translations in dynamically (which doesn't seem to be easily achievable with it).

It's working perfectly unless there are multiple concurrent requests to one page. I noticed this after having the app crash on my server. This occurs both in dev and prod mode.

You can reproduce this by cloning: https://github.com/skruf/bug

and running loadtest:

⋊> ~ loadtest -n 10 -c 2 http://127.0.0.1:3000/test                                                                            16:36:05
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Target URL:          http://127.0.0.1:3000/test
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Max requests:        10
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Concurrency level:   2
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Agent:               none
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Completed requests:  10
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Total errors:        4
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Total time:          0.225655034 s
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Requests per second: 44
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Mean latency:        43.6 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO Percentage of the requests served within a certain time
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO   50%      43 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO   90%      57 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO   95%      57 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO   99%      57 ms
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO  100%      57 ms (longest request)
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO  100%      57 ms (longest request)
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO
[Wed May 10 2017 16:36:24 GMT+0200 (CEST)] INFO   500:   4 errors

As you can see, it fails almost every other request. Am I just retarded, or is this a possible bug?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c598">#c598</a>)</em></sub></div>