Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-883

Use of Math.min In GossipRouter's Socket Linger Code Causes Unexpected Results

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.4.5, 2.6.8, 2.8
    • 2.4.4, 2.5.2, 2.6.7, 2.7
    • None
    • Release Notes
    • Low

      From 2.6.7 Gossip Router Code:

      /** Time (in millis) for setting SO_LINGER on sockets returned from accept(). 0 means don't set SO_LINGER */
      private long linger_timeout=2000L;

      ...snip...

      if(linger_timeout > 0)

      { int linger=Math.min(1, (int)(linger_timeout / 1000)); sock.setSoLinger(true, linger); }

      This means that the socket linger timeout will always be 1 regardless of what you set exception when a millisecond value of less than one second is specified which isn't valid for a socket linger timeout anyway. Math.max should likely be used instead.

            rhn-support-jawilson Jimmy Wilson
            rhn-support-jawilson Jimmy Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: