g4klx / MMDVMHost

The host program for the MMDVM
GNU General Public License v2.0
378 stars 275 forks source link

Bug fixed - DMR disable - overflow in the DMR slot RF queue #806

Open klaute opened 7 months ago

klaute commented 7 months ago

Hi,

the solution to this issue is shown at the bottom of this post.

I‘m running MMDVMHost host on a Linux system. It is a server system, AMD Ryzen, 8 code 8 GB RAM, M.2 SDD, …

My STM32F103 RF7021SE is running the latest MMDVM_HS firmware.

The software is build based on the latest master branch of the MMDVMHost GitHub repository.

I only use DMR and the host is successfully connected to the DMR Network.

So first of all, I do not have any power supply, outdated software versions or performance issues. Mostly everything works like a charm.

The one issue I’m facing: What I tried to do is to disable DMR using the Remote Control feature. My expectation is that if I disable DMR, also the connection to the DMR network gets kind of disabled/disconnected and no more data will be received from the network.

At first after disabling DMR everything looks good until the Host receives multiple seconds of QSO‘s. Which can’t sent out through the RF7021SE, because DMR is disabled. A Hundreds of messages like the following get logged then on the try and into the Logfiles:

mmdvmhost | E: 2024-04-09 17:22:06.243 DMR Slot 2, overflow in the DMR slot RF queue

From my side, this looks like a bug. I tested it on my Linux Server and also on a Mac M1.

The code in file MMDVMhost.cpp, line 2634, tries to disable the DMR network:

case RCD_DISABLE_DMR:
            if (m_dmr != NULL && m_dmrEnabled)
                processEnableCommand(m_dmrEnabled, false);
            if (m_dmrNetwork != NULL)
                m_dmrNetwork->enable(false);
            break;

So far so good, but what I saw during debugging is that in DMRDirectNetwork.cpp the bool value m_enabled get set to false (line 146), but the old value (true) still appears in line 397/397 which causes that the buffer still gets filled. Which triggers the overflow message.

This is the solution:

In the header file DMRDirectNetwork.h add the keyword "volatile" to the bool m_enabled variable.

volatile bool m_enabled;

No it works as intended on my systems. I can enable and disable DMR without filling my harddrive with queue overflow messages.

Thank you! 73

bi7jta commented 7 months ago

Hi klaute, Cool! I also meet this "overflow in the DMR slot RF queue" in one of my HAT , it not only in DMR mode ,but also in D-STAR, I exclude each components, I keep this hat, I can re-appear it , seem the ADF7021x problem or other components on the board.

I will try your method and feedback here.

klaute commented 7 months ago

I have done a few more changes.

Please find the changes in the attached patch file.

DMR_disabled_buffer_overflow.patch