Skip to content

Fix/critical bugs#552

Open
TheOfficialDragone wants to merge 2 commits into
Stefal:masterfrom
TheOfficialDragone:fix/critical-bugs
Open

Fix/critical bugs#552
TheOfficialDragone wants to merge 2 commits into
Stefal:masterfrom
TheOfficialDragone:fix/critical-bugs

Conversation

@TheOfficialDragone

Copy link
Copy Markdown

No description provided.

TheOfficialDragone and others added 2 commits June 28, 2026 23:23
- RTKLIB.shutdown(): change `elif` to `if` so shutdownBase() is called
  when satellite_thread exists (the normal running state). Previously,
  reboot and shutdown handlers would return 1 without stopping the base.

- RTKLIB.processLogPackage(): replace deprecated Thread.isAlive() with
  is_alive(). isAlive() was removed in Python 3.9; RTKBase requires 3.11.
  The AttributeError was silently caught, making the concurrent-conversion
  guard always false, allowing multiple simultaneous log conversions.

- Str2StrController.setTCPClientStream(): fix NameError — was using
  undefined tcp_server_parameters instead of tcp_client_parameters.

- Str2StrController.setNTRIPServerStream(): fix NameError — was using
  undefined ntrip_client_parameters instead of ntrip_server_parameters.

- Str2StrController.setTCPServerStream(): fix silent parameter ignore —
  was always using def_parameters[0] ("9000") instead of the passed
  tcp_server_parameters[0].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- RTKBaseConfigManager.expand_path(): replace str.strip() with
  str.removeprefix() for $BASEDIR substitution. strip() removes any
  character in the set from both ends, not just the prefix, which can
  silently corrupt paths containing those characters.

- LogManager.updateAvailableLogs(): move sort() call outside the for
  loop. Sorting on every append is O(n² log n); with many log files on
  a Raspberry Pi this is measurably slow.

- network_infos.get_interfaces_infos(): merge two nmcli.device.show()
  calls per interface into one, halving the number of subprocess forks
  when displaying network info in the settings page.

- server.update_settings(): guard against empty json_msg before pop()
  to prevent an uncaught IndexError that would silently kill the socket
  handler under malformed client input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@TheOfficialDragone

Copy link
Copy Markdown
Author

What this PR fixes

Five bugs found by static code review. Two cause silent failures on the minimum supported Python version (3.11); one causes incorrect reboot/shutdown behavior.


1. RTKLIB.shutdown()elif makes shutdownBase() unreachable (RTKLIB.py)

# Before (broken)
if self.satellite_thread is not None:
    self.satellite_thread.join()
elif self.state == "base":      # ← never evaluated when thread exists
    return self.shutdownBase()

When the satellite broadcast thread is running (the normal operational state), the elif is never evaluated and shutdownBase() is never called. Both the Reboot and Shutdown buttons in the web UI call rtk.shutdown() — both silently returned 1 without actually stopping the base. Fixed by changing elifif.


2. RTKLIB.processLogPackage()Thread.isAlive() removed in Python 3.9 (RTKLIB.py)

try:
    currently_converting = self.conversion_thread.isAlive()  # removed in Python 3.9
except AttributeError:
    pass  # silently caught — currently_converting stays False

Thread.isAlive() was removed in Python 3.9. On Python 3.11 (RTKBase minimum), the call raises AttributeError, which the existing except AttributeError block catches — an except originally meant to handle NoneType access when conversion_thread is None. The result: the concurrent-conversion guard always evaluates to False, allowing multiple simultaneous log conversions that can corrupt the output zip. Fixed by replacing isAlive() with is_alive().


3. Str2StrController.setTCPClientStream()NameError on call (Str2StrController.py)

port = "tcpcli://" + ":".join(tcp_server_parameters)  # NameError: tcp_server_parameters not defined

The correct variable is tcp_client_parameters.


4. Str2StrController.setNTRIPServerStream()NameError on call (Str2StrController.py)

port = "ntrips://:" + ntrip_client_parameters[0] + ...  # NameError: ntrip_client_parameters not defined

Parameter name is ntrip_server_parameters.


5. Str2StrController.setTCPServerStream() — passed argument silently ignored (Str2StrController.py)

if tcp_server_parameters is None:
    tcp_server_parameters = def_parameters
port = "tcpsvr://:" + def_parameters[0]   # always "9000" regardless of what was passed

Fixed to use tcp_server_parameters[0].


How to test

  • Trigger Reboot or Shutdown from the web UI → confirm the base stops cleanly before the system goes down
  • Start a log conversion, immediately trigger a second one → confirm only one runs at a time
  • Verify setTCPClientStream(["192.168.1.1", "9000"]) builds tcpcli://192.168.1.1:9000 correctly
  • Verify setTCPServerStream(["8080"]) uses port 8080, not the hardcoded 9000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant