I was doing a pi project where pi communicates with a UHF ID card reader via hardware serial and read cards. Pi gets the card information through serial and upload them to a remote database. Also some other common peripherals like LCD, RTC are connected to pi. I programmed the project with python2.
The project works OK. But after 15 to 30 days later program crashes with error 

Illegal instruction

. And when this happens python2 package no longer run. If I run python2 from a terminal it throws same error and exits. Just a single line as shown above.
Can't understand why this is happening. I searched through internet and found that in some cases some modules cause this problem which are related to CPU instructions(Though they are for PCs). But in this case it is not some module which are the source of the problem because if it was then the python interpreter should work properly.
What additional tests can I do to trace the problem?
Thanks!
Should upgrade to new version of python series such as python 3.7, 3.8 and 3.9, because python 2.7 will move to 3.7
Illegal instruction when running python on raspberry pi