<h2>Events are Stuck in Ready State.</h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><ul style="list-style-position: inside;"><li>On em_events table, we see that a huge number of events are stuck in the "Ready" state and not processing at all. The jobs were not running but after restarting the job, some events processed but later, events stopped processing again.</li></ul></section></div><div ><h3 >Cause</h3><section><ul style="list-style-position: inside;"><li>The cause of the issue is identified with Duplicate Event Type Field and because of customization.</li><li>When events are generated, it tries to create an entry in em_event_type table. In this case, whenever the processor script tried to create entry we see an error as below</li></ul> <pre style="padding-left: 40px;"><span style="background-color: #ff0000; color: #ffffff;">Unique Key violation detected by database ((conn=1540068) Duplicate entry '<Event Type Value>' for key 'name')</span><br /><span style="background-color: #ff0000; color: #ffffff;">java.sql.SQLIntegrityConstraintViolationException: (conn=1540068) Duplicate entry '<Event Type Value>' for key 'name'</span></pre> <ul style="list-style-position: inside;"><li>This error can be seen in system logs or node logs.</li><li style="text-decoration: underline;">I<strong>n this specific case the event_type field on em_event table is customized</strong> and the same customization is not done considering the em_event_type table attributes.</li></ul></section></div><div ><h3 >Resolution</h3><section><ul style="list-style-position: inside;"><li>In order to fix the issue, disable/error all the events with the specific event type. Once it is done, all the events will start processing.</li><li>In a normal case, the issue would not occur. Disabling the customization and reverting to the original behavior will fix this issue for all upcoming events.</li></ul></section></div></article></div>