🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
12 messages
12 total messages Started by Iulius Wed, 18 Oct 2006 21:10
inn2-ssl and lots of idle connections
#74399
Author: Iulius
Date: Wed, 18 Oct 2006 21:10
44 lines
3293 bytes
Hi,

I am using inn2-ssl with the following start up:
/usr/lib/news/bin/nnrpd-ssl -D -c /etc/news/readers-ssl.conf -p 563 -S

My « inn.conf » has:
clienttimeout:          1800


I have no problem with nnrpd (idle connections are closed) but some nnrpd-ssl
connections keep being opened for a long time.
I do not know what is happening.

For instance:

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
news      4146  0.0  0.2  7028 2716 ?        SN   Sep29   0:00 - nnrpd-ssl: connected                                               S
news      5979  0.0  0.2  7028 2716 ?        SN   Sep29   0:00 - nnrpd-ssl: connected                                               S
news      8968  0.0  0.2  7028 2716 ?        SN   Sep29   0:00 - nnrpd-ssl: connected                                               S
news      9025  0.0  0.2  7028 2716 ?        SN   Sep29   0:00 - nnrpd-ssl: connected                                               S
news      9208  0.0  0.2  7028 2716 ?        SN   Sep29   0:00 - nnrpd-ssl: connected                                               S
[...]
news     16186  0.0  0.2  7028 2716 ?        SN   Oct02   0:00 - nnrpd-ssl: connected                                               S
news     19237  0.0  0.2  7028 2716 ?        SN   Oct02   0:00 - nnrpd-ssl: connected                                               S
news     25838  0.0  0.2  7028 2716 ?        SN   Oct02   0:00 - nnrpd-ssl: connected                                               S
news     27328  0.0  0.2  7028 2716 ?        SN   Oct02   0:00 - nnrpd-ssl: connected                                               S
news     28348  0.0  0.2  7028 2716 ?        SN   Oct02   0:00 - nnrpd-ssl: connected                                               S
[...]

Furthermore, I do not see those PID in my « news.notice » since the time of the last connection (Sep29, Oct02)...

I have more than 600 idle connections and the number keeps increasing.

Do you know what the problem is? Why the main part of the connections is properly closed while
some are still here?

Thanks for your help.

Regards,

-- 
Iulius

« Je viens souvent me faire suer ici ! » (Astérix)
Re: inn2-ssl and lots of idle connections
#74400
Author: Jeffrey M. Vinocur
Date: Thu, 19 Oct 2006 06:04
28 lines
2145 bytes
In article <eh657r$knl$1@guepard.ecp.fr>,
Iulius  <iulius@nom-de-mon-site.com.invalid> wrote:
>
>I have no problem with nnrpd (idle connections are closed) but some nnrpd-ssl
>connections keep being opened for a long time.

Right, the current TLS implementation does not support timeouts
at all; this is on our TODO list but will probably not be fixed
anytime soon.

Any client that sends a QUIT command before exiting should work
fine, and I think any client that just closes the socket without
any QUIT would probably work fine too.  So I'm not sure exactly
what situation you're seeing that triggers this problem with
timeouts -- maybe there are users leaving their newsreaders open
for prolonged periods of times, or are somehow dropping the
network connection without any sort of closure.

If you're interested in investigating those possibilities, you
might try to track down (with the `netstat` utility, or via the
news logs showing how the clients in question authenticated)
which exact clients are involved and if there's anything they
have in common.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: inn2-ssl and lots of idle connections
#74406
Author: Iulius
Date: Fri, 20 Oct 2006 13:16
56 lines
2979 bytes
En réponse à Jeffrey M. Vinocur :
> Right, the current TLS implementation does not support timeouts
> at all; this is on our TODO list but will probably not be fixed
> anytime soon.

All right.
Thanks for having answered me.


> Maybe there are users leaving their newsreaders open
> for prolonged periods of times

Perhaps.


> or are somehow dropping the
> network connection without any sort of closure.

I don't know.
Is the problem found in every inn2-ssl?


> If you're interested in investigating those possibilities

Sure!


> you might try to track down (with the `netstat` utility, or via the
> news logs showing how the clients in question authenticated)
> which exact clients are involved and if there's anything they
> have in common.

First of all, if there is in « ps aux »

news      8656  0.0  0.2  7028 2716 ?        SN   Oct19   0:00 - nnrpd-ssl: connected

should a line with « nnrpd-ssl[8656] » appear in « news.notice »?

In fact, I have lots of similar PID which don't appear in « news.notice » (or its daily
rotations)... I don't know whether this fact can be of help (a connexion attempt?).


And for those which appear, it looks normal.

Oct 14 00:48:42 xxx nnrpd-ssl[3825]: starttls: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits) no authentication
Oct 14 00:48:42 xxx nnrpd-ssl[3825]: yyy (11.11.1.11) connect
Oct 14 00:48:43 xxx nnrpd-ssl[3825]: yyy user iulius
Oct 14 00:48:43 xxx nnrpd-ssl[3825]: yyy group group 0
[...]
Oct 14 00:48:50 xxx nnrpd-ssl[3825]: yyy times user 0.045 system 0.008 idle 0.030 elapsed 8.027
Oct 14 00:48:50 xxx nnrpd-ssl[3825]: yyy time 8029 idle 7691(40) nntpwrite 0(81)

-- 
Iulius

« Si l'amour est aveugle, il faut palper. »
Re: inn2-ssl and lots of idle connections
#74425
Author: Russ Allbery
Date: Mon, 23 Oct 2006 15:49
204 lines
7574 bytes
Jeffrey M Vinocur <jeff@litech.org> writes:

> Right, the current TLS implementation does not support timeouts at all;
> this is on our TODO list but will probably not be fixed anytime soon.

And, for reasons that I've never managed to figure out, the regular nnrpd
timeouts don't work for my reader server under stunnel either.  That may
be because I'm a few revisions back on 2.4, though, on that system (I keep
meaning to get around to upgrading).

Anyway, here's a script that comes in handy for all sorts of things like
this.  Will only work on systems that support SysV ps syntax (Linux
included).

#!/usr/bin/perl
$ID = q$Id: okill,v 1.3 2006-09-20 20:43:28 eagle Exp $;
#
# okill -- Kill processes that have been running longer than certain hours.
#
# Written by Susan Feng
# Copyright 2005, 2006, Board of Trustees, Leland Stanford Jr. University

##############################################################################
# Modules and declarations
##############################################################################

use strict;
use vars qw($ID $PS $LIMIT);

use Getopt::Long qw(GetOptions);

# The syntax of this ps command should work across all SYSV platforms.
$PS = 'ps -e -o pid,ppid,user,etime,time,pcpu,comm';

# Default to killing jobs running for longer than 24 hours.
$LIMIT = 24;

##############################################################################
# Helper routines
##############################################################################

# Calculate the number of minutes from the [dd-]hh:mm:ss format used by the
# etime and cputime fields of ps.
sub calc_minutes {
    my $time = shift;

    $time =~ /^((\d+)-)?((\d+):)?(\d+):(\d+)$/;
    my ($days, $hours, $mins, $secs) = ($2, $4, $5, $6);

    $hours += $days * 24 if $days;
    $mins += $hours * 60 if $hours;
    return $mins;
}

##############################################################################
# Main routine
##############################################################################

# Always flush output and fix executable name.
$| = 1;
$0 =~ s%^.*/%%;

# Define the default signal type and limits.
my $signal = 1;
my ($etime_lim, $time_lim, $pcpu_lim) = (0, 0, 0);

# Parse command-line options.
Getopt::Long::config ('bundling');
my ($help, $dryrun, $verbose, $version, $parent);
GetOptions ('h|help'    => \$help,
            'e|etime=i' => \$etime_lim,
            't|time=i'  => \$time_lim,
            'c|pcpu=i'  => \$pcpu_lim,
            'n|dryrun'  => \$dryrun,
            'p|parent'  => \$parent,
            's|signal'  => \$signal,
            'verbose'   => \$verbose,
            'v|version' => \$version) or exit 1;
if ($help) {
    print "Feeding myself to perldoc, please wait....\n";
    exec ('perldoc', '-t', $0);
} elsif ($version) {
    my $version = join (' ', (split (' ', $ID))[1..3]);
    $version =~ s/,v\b//;
    $version =~ s/(\S+)$/($1)/;
    die $version, "\n";
}

die "Usage: $0: okill [-etime <minutes>] [-n] [-p] procname\n"
    unless my $procname = shift @ARGV;

# Always be verbose if we are doing a dry run.
$verbose = 1 if $dryrun;

# Open up the process list and start reaping the old ones.
open (PROCS, "$PS |") or die "$0: unable to run $PS\n";
my ($pid, $ppid, $user, $etime, $time, $pcpu, $comm);
while (<PROCS>) {
    s/^\s+//;
    ($pid, $ppid, $user, $etime, $time, $pcpu, $comm) = split /\s+/;
    next unless $comm =~ /^(.*\/)?$procname$/;

    $etime = calc_minutes($etime);
    $time = calc_minutes($time);
    if ($etime >= $etime_lim && $time >= $time_lim && $pcpu >= $pcpu_lim) {
        if ($verbose) {
            print "killing $pid age $etime minutes\n";
            print "killing parent $ppid age $etime minutes\n" if $parent;
        }
        unless ($dryrun) {
            kill $signal, $pid unless $pid == 1;
            kill $signal, $ppid if $parent and $ppid != 1;
        }
    }
}
close (PROCS);

##############################################################################
# Documentation
##############################################################################

=head1 NAME

okill - Kill processes that have exceed certain limits

=head1 SYNOPSIS

B<okill> [B<-h>] [B<-v>]

B<okill> [B<--etime> I<minutes>] [B<-np>] [B<-s> I<signal>] <process name>

=head1 DESCRIPTION

okill takes a process name on the command line and finds all the processes
with that name and kills those exceeding certain limits.  This script
should run all System V compliant operating systems.  The init process
will never be killed.  The current supported limits are etime,
time, and pcpu.  See the OPTIONS section to see what these limits mean.

If more than one limit is supplied, then all the limits have to be
exceeded to avoid unnecessary killing.  If no limits are supplied, then
this script will kill all processes matching the command name (like the
pkill behavior).

=head1 OPTIONS

=over 4

=item B<-c> I<pcpu>, B<--pcpu>=I<percentage>

Kill matching processes that exceed the supplied cpu utilization.  pcpu
stands for the cumulative CPU time divided by the elapsed time.

=item B<-e> I<minutes>, B<--etime>=I<minutes>

Kill matching processes that have been running longer than the supplied
number of minutes.  etime stands for elapsed time.

=item B<-h>, B<--help>

Print out this documentation (which is done simply by feeding the script to
C<perldoc -t>).

=item B<-n>

Dry run only. Print out what would be killed. If [B<-p>] is given will
also print the parent process id.  Implies [B<--verbose>].

=item B<-p>, B<--parent>

Kill the parent process as well.  This is fairly dangerous.

=item B<-s> I<signal>, B<--signal>=I<signal>

By default, B<okill> sends signal 1 (HUP).  To specify a different signal,
use this flag.  The signal must be a number.  (15, TERM, is a common
choice.)

=item B<-t> I<minutes>, B<--time>=I<minutes>

Kill matching processes that exceed the supplied cumulative CPU time.

=item B<--verbose>

Verbose.  Print out what would be killed.

=item B<-v>, B<--version>

Print the version of B<okill> and exit.

=back

=head1 AUTHORS

Susan Feng,
Huaqing Zheng

=cut

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inn2-ssl and lots of idle connections
#74429
Author: Jeffrey M. Vinocur
Date: Mon, 23 Oct 2006 17:56
27 lines
1835 bytes
In article <ehai7b$ppn$1@guepard.ecp.fr>,
Iulius  <iulius@nom-de-mon-site.com.invalid> wrote:
>En réponse à Jeffrey M. Vinocur :
>
>> or are somehow dropping the
>> network connection without any sort of closure.
>
>I don't know.
>Is the problem found in every inn2-ssl?

Yes, as far as I know.


>
>Oct 14 00:48:42 xxx nnrpd-ssl[3825]: starttls: TLSv1 with cipher
>DHE-RSA-AES256-SHA (256/256 bits) no authentication
>Oct 14 00:48:42 xxx nnrpd-ssl[3825]: yyy (11.11.1.11) connect
>Oct 14 00:48:43 xxx nnrpd-ssl[3825]: yyy user iulius

Is this one of the connections that later remains open for a long
time?  What is happening on your client at that time?  Is the
program still open?


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: inn2-ssl and lots of idle connections
#74479
Author: Iulius
Date: Mon, 30 Oct 2006 09:50
35 lines
2236 bytes
En réponse à Russ Allbery :
> Anyway, here's a script that comes in handy for all sorts of things like
> this.  Will only work on systems that support SysV ps syntax (Linux
> included).

Thanks a lot.
I for one use:

%%%%%%%%%%%%%%%%%%%%
#!/bin/sh

for pid in `ps faux | grep "nnrpd-ssl: connected" | awk '{ print $2; }'`
     do
         kill $pid
     done
%%%%%%%%%%%%%%%%%%%%

Put in my cron.daily (nobody is connected to my local news server at the
time when the cron.daily is executed: 6:25).


> okill - Kill processes that have exceed certain limits
> B<okill> [B<--etime> I<minutes>] [B<-np>] [B<-s> I<signal>] <process name>

Do you really use that for killing nnrpd-ssl connections?

Because if I do that, it also kills the nnrpd daemon « nnrpd-ssl: accepting
connections »!
Thus, it kills everything...

-- 
Iulius

« -- C'est quoi la vesperna ?
   -- C'est du latin de cuisine imbécile ! » (Astérix)
Re: inn2-ssl and lots of idle connections
#74480
Author: Iulius
Date: Mon, 30 Oct 2006 10:10
65 lines
4090 bytes
En réponse à Jeffrey M. Vinocur :
>> Oct 14 00:48:42 xxx nnrpd-ssl[3825]: starttls: TLSv1 with cipher
>> DHE-RSA-AES256-SHA (256/256 bits) no authentication
>> Oct 14 00:48:42 xxx nnrpd-ssl[3825]: yyy (11.11.1.11) connect
>> Oct 14 00:48:43 xxx nnrpd-ssl[3825]: yyy user iulius
> 
> Is this one of the connections that later remains open for a long
> time?  What is happening on your client at that time?  Is the
> program still open?

In fact, I am not really sure of that one (if it is linked to a
remaining open connection).  It could have been a good attempt (with
the same pid before).

I have made further investigations.
Here are the commands:

30/10 10:54 news@guepard ~% ps aux | grep 'nnrpd-ssl' | more
news     13216  0.0  0.1  5788 1488 ?        SNs  Oct26   0:03 - nnrpd-ssl: accepting connections
news     14427  0.0  0.2  7028 2716 ?        SN   Oct26   0:00 - nnrpd-ssl: connected
[...]

guepard:/home/eliej# lsof -p 14427
COMMAND     PID USER   FD   TYPE     DEVICE    SIZE     NODE NAME
[...]
nnrpd-ssl 14427 news  mem    REG       3,10  589832  2113538 /var/spool/news/overview/group.index
nnrpd-ssl 14427 news    0u  IPv4   10854220              TCP news.ecp.fr:nntps->a-dns.fr:2049 (ESTABLISHED)
nnrpd-ssl 14427 news    1u  IPv4   10854220              TCP news.ecp.fr:nntps->a-dns.fr:2049 (ESTABLISHED)
nnrpd-ssl 14427 news    2u  IPv4   10854220              TCP news.ecp.fr:nntps->a-dns.fr:2049 (ESTABLISHED)
nnrpd-ssl 14427 news    3u  unix 0xe3f5a680         10842654 socket
nnrpd-ssl 14427 news    4r   REG        3,1     340    96936 /etc/news/overview.fmt
nnrpd-ssl 14427 news    5r   REG       3,10  589832  2113538 /var/spool/news/overview/group.index


There is no trace of that 14427 connection in my « news.notice » files.

But if I see what that client usually uses (for other connections):
nnrpd-ssl[17358]: starttls: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits) no authentication
He uses Thunderbird 1.0.2 for Windows.

To see all the clients, it is possible to do:
ps aux | grep 'nnrpd-ssl' | awk '{print "lsof -p " $2}' | sh | grep 'nntps' | more



After looking at about 20 connections, it is the same.  They all use Thunderbird (for Windows
or Linux, even the last 1.5.0.7 version), which I saw in articles they sent.
So perhaps it is a bug of Thunderbird.
Have you already seen that problem with other news readers?


I also currently have two connections of that sort:
news     21461  0.0  0.3  7284 3004 ?        SN   Oct27   0:00 - nnrpd-ssl: a-dns.fr AUTHINFO      S
with:
nnrpd-ssl 21461 news    0u  IPv4   11210086              TCP news.ecp.fr:nntps->a-dns.fr:1026 (CLOSE_WAIT)


I hope these information can be of help.

Regards,

-- 
Iulius

« J'en ricane d'aisance ! » (Astérix)
Re: inn2-ssl and lots of idle connections
#74481
Author: Jeffrey M. Vinocur
Date: Mon, 30 Oct 2006 19:10
22 lines
1763 bytes
In article <ei4j26$i9o$1@guepard.ecp.fr>,
Iulius  <iulius@nom-de-mon-site.com.invalid> wrote:
>
>After looking at about 20 connections, it is the same.  They all use
>Thunderbird (for Windows
>or Linux, even the last 1.5.0.7 version), which I saw in articles they sent.
>So perhaps it is a bug of Thunderbird.

Are you sure it's even a bug?  Maybe your users leave their
clients running for long periods of time, and the connections
remain active because the client is checking periodically for new
news?


>Have you already seen that problem with other news readers?

Not particularly.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: inn2-ssl and lots of idle connections
#74482
Author: Iulius
Date: Mon, 30 Oct 2006 19:33
18 lines
2026 bytes
En réponse à Jeffrey M. Vinocur :
> Maybe your users leave their
> clients running for long periods of time, and the connections
> remain active because the client is checking periodically for new
> news?

I do not think so since such clients have already opened new connections.
And it appears that some connections are in that state from the beginning
(no log in « news.notice » and but in « connected » for ever).

Moreover, it looks as though active connections are on « GROUP »/« XOVER »
or « ARTICLE » state (and never in only « connected ») in a « ps aux ».
I do not see any in the « connected » state.

-- 
Iulius

« Quand tu auras lu ces lignes, le papyrus s'autodétruira. » (Astérix)
Re: inn2-ssl and lots of idle connections
#74484
Author: Russ Allbery
Date: Tue, 31 Oct 2006 04:22
19 lines
1893 bytes
Iulius <iulius@nom-de-mon-site.com.invalid> writes:

>> okill - Kill processes that have exceed certain limits
>> B<okill> [B<--etime> I<minutes>] [B<-np>] [B<-s> I<signal>] <process name>

> Do you really use that for killing nnrpd-ssl connections?

> Because if I do that, it also kills the nnrpd daemon « nnrpd-ssl: accepting
> connections »!
> Thus, it kills everything...

Yes, I kill all nnrpd processes older than a day, since the old processes
also hold open old copies of the history file.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inn2-ssl and lots of idle connections
#74529
Author: Iulius
Date: Tue, 28 Nov 2006 16:42
28 lines
2182 bytes
En réponse à Jeffrey M. Vinocur :
>> After looking at about 20 connections, it is the same.  They all use
>> Thunderbird (for Windows
>> or Linux, even the last 1.5.0.7 version), which I saw in articles they sent.
>> So perhaps it is a bug of Thunderbird.
> 
> Are you sure it's even a bug?  Maybe your users leave their
> clients running for long periods of time, and the connections
> remain active because the client is checking periodically for new
> news?
> 
>> Have you already seen that problem with other news readers?
> 
> Not particularly.

Could it be related to:
https://bugzilla.mozilla.org/show_bug.cgi?id=253523

%%
I experienced this problem as well. It seems the SSL implementation of INN
doesn't play well with NSS. If I setup connections (on the server side) to go
through stunnel instead it all works perfect.
%%

-- 
Iulius

« Rien ne serpe de courir ! » (Druides gaulois)
Re: inn2-ssl and lots of idle connections
#74532
Author: Russ Allbery
Date: Tue, 28 Nov 2006 19:58
24 lines
2190 bytes
Iulius <iulius@nom-de-mon-site.com.invalid> writes:

> Could it be related to:
> https://bugzilla.mozilla.org/show_bug.cgi?id=253523

> %%
> I experienced this problem as well. It seems the SSL implementation of INN
> doesn't play well with NSS. If I setup connections (on the server side) to go
> through stunnel instead it all works perfect.
> %%

I'm not sure that the current SSL implementation in INN is really correct,
but I don't know enough about how OpenSSL is supposed to be used to check
it and I haven't had time to learn.  If someone else has the knowledge or
willingness to research it, I would be very interested in the results.

(At the least, I do know that the protocol codes are wrong and need to be
fixed to match the newly released NNTP STARTTLS standard.)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads