Dan-in-CA / sip_plugins

Plugins for SIP
28 stars 50 forks source link

Plugin crashes Thread when using Master Station #60

Open seventer opened 2 years ago

seventer commented 2 years ago

When using a Master Station (postive and/or negative seconds) the plugin crashes the program thread resulting in unresponsive stations. The crashdump is:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/SIP/sip.py", line 188, in timing_loop
    report_running_program_change()
  File "/home/pi/SIP/helpers.py", line 90, in report_running_program_change
    running_program_change.send()
  File "/home/pi/SIP/blinker/base.py", line 266, in send
    return [(receiver, receiver(sender, **kwargs))
  File "/home/pi/SIP/blinker/base.py", line 266, in <listcomp>
    return [(receiver, receiver(sender, **kwargs))
  File "/home/pi/SIP/plugins/sip_email.py", line 153, in email_start_stop
    if gv.pd[p_idx]["name"]:
IndexError: list index out of range

https://github.com/Dan-in-CA/sip_plugins/blob/916e291f0dd6c96235b9d5db6d1066f2f5e2bff3/sip_email/sip_email.py#L153

Tested with a Master Station enabled and using Run Once on a single station

Dan-in-CA commented 2 years ago

The error is being caused by the email plugin. I'll take a look at it. Dan

Dan-in-CA commented 2 years ago

That looks like a bug that has been there since program naming was added. It was looking for a program name in the program data dictionary when run-once and manual mode don't have a data dictionary. Fixed now. Thanks Gerard for discovering this.

seventer commented 2 years ago

It works fine now. Both the Run-now and program tested. However the e-mail content has some cosmetic issues but I will do some more testing and create a new issue for it.