OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Segmentation Fault On Initial Startup

  • This topic has 1 reply, 2 voices, and was last updated 1 month ago by Ray.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #86018

    curvin777
    Participant

    Afternoon!

    Just wanted to toss out some info that doesn’t seem to be documented anywhere that I could find or in any bug reports.

    I recently purchased an OSPi setup and attached a Pi3 to it that was setup on an airgapped network. Loosely following the build docs, I git cloned the repo on a separate internet-connected system, and then transferred the project to the Pi for the remaining build steps. I was able to perform the build setup by using an apt proxy setup on the airgapped network to grab the necessary packages, and the build completed successfully, systemd setup all worked, and the service started up ./OpenSprinkler successfully. Even netstat showed the service was listening on port 8080. But attempting to access the web ui or curl’ing localhost:8080 from the command line on the Pi would fail. Checking the status systemctl status OpenSprinkler and journalctl -u OpenSprinkler showed that it was segfaulting over and over. When running an strace while manually starting /path/to/OpenSprinkler showed that it was likely segfaulting while trying to access the weather data.

    Moving the Pi to an Internet-connected network resolved the issue, so it does seem to strongly suggest the issue is related to something in the code requiring an internet connection. Maybe a suggestion would be to refactor a portion of the code to make the Internet connection/services optional since the device seems like it is possibly designed to optionally be operated completely offline, plus it would eliminate the segfault that doesn’t clearly identify the reason for failing to access the web ui and the service failing. So far, it seems like a very nice system, thank you for all the hard work on this! I hope this post helps if anyone else runs into a similar situation.

    -Chad

    #86026

    Ray
    Keymaster

    I was not aware of this issue at all – the firmware does not require a successful weather call – if the call fails it should simply move on and continue using the default time zone and sunrise/sunset times. I asked Claude Code to analyze the code and check what maybe causing the segfault, and here is what it says:

      The fix is in etherport.cpp: both EthernetClientSsl constructors need ssl(NULL) in their      
      initializer lists.
                                                                                                    
      ⎿  Added 2 lines, removed 2 lines
          373  static SSL_CTX* ctx = NULL;
          374  
          375  EthernetClientSsl::EthernetClientSsl()
          376 -    : EthernetClient()                                                                  
          376 +    : EthernetClient(), ssl(NULL)                                                       
          377  {
          378  }
          379  
          380  EthernetClientSsl::EthernetClientSsl(int sock)
          381 -    : EthernetClient(sock)                                                              
          381 +    : EthernetClient(sock), ssl(NULL)                                                   
          382  {
          383  }
          384
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Segmentation Fault On Initial Startup