I found running my Volumio plugin in combination with other plugins was not the cause of the problem. When I disabled all plugins except Volumio the issue persist.
For further investigation, I had to modify Domoticz source code to log what Python exception was raised and not just message "Python exception set prior to callback" - just this one line added to Plugin.cpp:
Code: Select all
$ diff ./hardware/plugins/Plugins.cpp.orig ./hardware/plugins/Plugins.cpp
1831a1832,1833
>
> LogPythonException(sHandler);
so the part of the code looks as follows:
Code: Select all
void CPlugin::Callback(PyObject *pTarget, const std::string &sHandler, PyObject *pParams)
{
try
{
// Callbacks MUST already have taken the PythonMutex lock otherwise bad things will happen
if (pTarget && !sHandler.empty())
{
if (PyErr_Occurred())
{
LogPythonException(sHandler);
PyErr_Clear();
Log(LOG_NORM, "(%s) Python exception set prior to callback '%s'", m_Name.c_str(), sHandler.c_str());
}
After rebuilding Domoticz and running it, I finally got Python error logged by Domoticz:
Code: Select all
2022-02-10 15:55:06.120 Volumio: (Volumio) Python exception set prior to callback 'onMessage'
2022-02-10 15:55:06.119 Error: Volumio: (Volumio) 'onMessage' failed 'OverflowError':'Python int too large to convert to C long'.
so the reason is an overflow error when converting Python int to C long int value. I did not notice this problem when testing the plugin on my Domoticz test VM because it was running 64-bit OS version (allows bigger value of long int) while my "production" Domoticz system on Raspberry Pi is running Raspbian which is available as 32-bit OS only.
Knowing the cause of the issue, I identified problematic code in the plugin - masking key generated for Websocket frame was passed to Send() method as (int) number instead of string. I'm testing the fix now and will commit the fix in Volumio plugin repository soon.