Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64413

ircbot-plugin does not log server errors, and defaults to a name that may be too long


    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ircbot-plugin
    • None
    • ircbot-plugin 2.36 (prototype snapshot)
      ngircd-22-2.1 (old RPM on old system)

      While testing recent fixes for the plugin, one of my installations refused to connect to the IRC server:

      2020-12-10 09:38:45.316+0000 [id=45]    INFO    h.p.ircbot.v2.IRCConnection#connect: Connecting to as jenkins-bot using charset UTF-8
      2020-12-10 09:38:45.326+0000 [id=1003]  INFO    org.pircbotx.PircBotX#connect: Connected to server.
      2020-12-10 09:38:45.327+0000 [id=1003]  INFO    org.pircbotx.output.OutputRaw#rawLineNow: NICK jenkins-bot
      2020-12-10 09:38:45.328+0000 [id=1003]  INFO    org.pircbotx.output.OutputRaw#rawLineNow: USER jenkins-bot 8 * :PircBotX 2.0.1, a fork of PircBot, the Java IRC bot - pircbotx.googlecode.com
      2020-12-10 09:38:45.330+0000 [id=1003]  SEVERE  org.pircbotx.PircBotX#startLineProcessing: Exception encountered when reading next line from server
      java.net.SocketException: Connection reset
              at java.net.SocketInputStream.read(SocketInputStream.java:210)
              at java.net.SocketInputStream.read(SocketInputStream.java:141)
              at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
              at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
              at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
              at java.io.InputStreamReader.read(InputStreamReader.java:184)
              at java.io.BufferedReader.fill(BufferedReader.java:161)
              at java.io.BufferedReader.readLine(BufferedReader.java:324)
              at java.io.BufferedReader.readLine(BufferedReader.java:389)
              at org.pircbotx.PircBotX.startLineProcessing(PircBotX.java:250)
              at org.pircbotx.PircBotX.connect(PircBotX.java:236)
              at org.pircbotx.PircBotX.startBot(PircBotX.java:151)
              at hudson.plugins.ircbot.v2.IRCConnection$2.run(IRCConnection.java:221)
      2020-12-10 09:38:45.330+0000 [id=1003]  INFO    org.pircbotx.dcc.DccHandler#close: Terminating all transfers waiting to be accepted
      2020-12-10 09:40:45.117+0000 [id=45]    WARNING h.p.ircbot.v2.IRCConnection#connect: Time out waiting for connecting to irc
      2020-12-10 09:40:45.117+0000 [id=45]    WARNING h.p.im.IMConnectionProvider#create: Could not create IM connection
      hudson.plugins.im.IMException: Connection failed
              at hudson.plugins.ircbot.v2.IRCConnectionProvider.createConnection(IRCConnectionProvider.java:42)
              at hudson.plugins.im.IMConnectionProvider.create(IMConnectionProvider.java:60)
              at hudson.plugins.im.IMConnectionProvider.access$500(IMConnectionProvider.java:17)
              at hudson.plugins.im.IMConnectionProvider$ConnectorRunnable.run(IMConnectionProvider.java:167)
              at java.lang.Thread.run(Thread.java:748)
      2020-12-10 09:40:45.207+0000 [id=45]    INFO    h.p.i.IMConnectionProvider$ConnectorRunnable#run: Reconnect failed. Next connection attempt in 16 minutes

      I assumed it was because of VPNs and firewalls enroute so did not drill into it so much, but now re-created the situation from the LAN with the server:

      $ telnet 6667
      Connected to
      Escape character is '^]'.
      NICK jenkins-bot
      :ngircd.localdomain 432 * jenkins-bot :Nickname too long, max. 9 characters
      USER jenkins-bot
      Connection to closed by foreign host.

      Oops, so the name is too long... Would have been nice to see that hint in the stacktrace of the aborted connection attempt!

      The server's config file /etc/ngircd.conf has something to say on this:

              # Maximum length of an user nickname (Default: 9, as in RFC 2812).
              ;MaxNickLength = 9

      So there are things to amend in the plugin:
      1) Constrain the default nickname for new installations to 9 chars

      • mention the standard limit in the help message for the nickname field;
      • (optional) pop up a warning for names that are longer
      • do not forbid the longer names in code - e.g. freenode allows them

      2) If there are some bytes read from the server connection if we get a "java.net.SocketException: Connection reset" at org.pircbotx.PircBotX.startLineProcessing(PircBotX.java:250) at org.pircbotx.PircBotX.connect(PircBotX.java:236) - flush them into the log with the stack trace, they might help deployers fix their issue

      3) (would be nice) Expose somehow (in global config page?) the current connection status, whether the bot is logged into a server at all and into the channels in particular; and if there was such a connection reset with an error message.

            jimklimov Jim Klimov
            jimklimov Jim Klimov
            0 Vote for this issue
            1 Start watching this issue