EMR Direct Phimail Background Service Stuck at BUSY

Hello all,
I am having a devil of a time getting EMR Direct, PHImail working correctly.
One issue I have noticed is that the Phimail service is always BUSY when checking the Background Services page and the next scheduled run of the phimail service is back in August of 2021 and will never run as the service is always busy.
So… I am surmising that the process is frozen and I don’t know how to kill it or reset it.
Please see the accompanying screenshots for what is happening.


Any help would be appreciated.
Thank you,
Mark L. Sarnov, MD

Mark,
There is an outstanding bug in the EMRDirect where if you receive a file that is not in the approved whitelist it will fail over and over again and you won’t get your messages. You can check by logging into EMRDirect via their web portal interface and check to see if you have any messages with attachments (phiMail Web | EMR Direct). If you do you’ll want to add the mime type for that message attachment in the Files Type white list list as workaround to this problem. The list is available in Administration → Forms → Lists. For example by default CCDA’s sent via straight up xml file are not received in the default OpenEMR installation and have to be added by adding in the ID and Title column text/xml.

I’m in the process of fixing this problem and some other issues with OpenEMR’s EMRDirect as part of our ONC certification. That will likely be in the 6.1.0 or 7.0.0 release.

Hope that solves your problem, if its something else I’d love to know about it so we make sure to get it resolved in the upcoming releases.

Thank you for the information. I will add the text/xml to the white list.
Unfortunately, I cannot login to the phimail web interface as the license I have is only for the EMR integration. Any way I can find out what the background service is working/choking on?
Mark

You can try and look at the Reports → Services → Direct message Log but I didn’t find those very helpful when running into the problem I experienced. If you have a different problem that might give you some details. If it fails on the whitelist it will just silently fail and then try to pull down the file every single direct mail check so it never finishes. I had to go in and add a bunch of debugging logs just to find out what was going on.

The place you could try adding log entries to in case you have a different mime type other than text/xml would be in library/sanitize.inc.php::isWhiteFile() (around line 117). You can do an
error_log("Direct message mime type found " . $mimetype);
and then check your error logs and see what the mime type is that its failing on.

If its something else than perhaps the Direct message log will help you figure that out.

And, a silly question… Where the heck are the error logs for OpenEMR??
:confused:

Nevermind the logs. I figured out the issue.
I used phpmyadmin to check the background services database entries and changed the running value for phimail from “1” to “0” and updated the next run time to a few minutes into the future.
Saved the database entry and went back to OpenEMR.
The phimail entry in background services “Currently Busy” was listed as “No” and once the future time arrived, the service ran and downloaded a package sent to myself, received the package and then reset for 5 minutes in the future.
I think I solved it.

There should really be some sort of way to “Kill” the background service from within OpenEMR as I am sure I am not the only one that had this bug come up.

Thank you!
Mark L. Sarnov, MD

1 Like