vendredi 28 octobre 2016

LoadBalanced AWS EC2 Instances Intermittently fail a jQuery xhr.send with a 500 Error

I have set up a Load Balanced Environment on AWS, containing two EC2 Servers, running a Laravel 5.3 website.

The LB polls every 2 minutes for a successful connection to an html file Called Healthy.html on each instance.

Also every 2 minutes each instance syncs it's contents with a folder stored on an S3 Bucket. This means I can push amendments to the bucket and all EC2 Instances pick up those amendments and sync every 2 mins.

I am using Jquery to ASynchronously POST to a route called /register to send an email.

This works every time in the local and dev environment. It works every time when I connect to each EC2 Instance seperately.

However, it will intermittently through a server 500 error (on the jquery xhr.send() call) when I run this via the loadbalanced URL.

To explain this "intermittent" behaviour more, the first time I submit the form, it throws a 500 error. If i click the button again it submits the form and sends the email. if I click it again it will throw a 500 error. Each time I do not change the data or refresh the page.

And it's the intermittent behaviour that is confusing me. Is it possible that the Asynchronous call is hopping onto the second server and thus the session is invalid?

Any other possibilities?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire