From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: More tcp problems
Date: Thu, 27 Sep 2001 12:30:49 +0100 [thread overview]
Message-ID: <10779.1001590249@csr.com> (raw)
There are a few more problems with the tcp module and its interaction with
zftp. I was hoping to fix the first one before releasing a new development
version, but it seems it goes beyond that.
- Closing a zftp connection doesn't set the session pointer to NULL. This
results (in my case) in a segmentation violation when opening a second
connection. This is because the tcp_close() frees the session, so it
can't be re-used or even tested again. (Simply setting the pointer to
NULL caused other problems I didn't understand, maybe related to the rest
of this list.)
- Don't know if this is related, but I get
BUG: attempt to free storage at invalid address
when opening zftp connections, in particular the first (since I
don't get as far as a second).
- In general, it seems a little bit difficult to tell whether tcp_close()
has actually freed the session or not. And if it hasn't, because it
encountered an error with close(), it's hard to see how the session
should be freed. I think another call to tcp_close() would do it --- but
it's hard to know when you need that. If you do it when the session has
already been freed, you're in big trouble.
- There's a similiar problem with tests for (sess->fd == -1) in zftp.
If they're true, the session is never freed; opening a new one will
simply assign a different TCP session to the same pointer, so that
the memory leaks.
- With a failed zfopen, I now get
zfopen:42: connection close failed: bad file number
(plus a segmentation violation which I guess is something to do with the
previous stuff). I don't get that message with 4.0.1. The function tests
at that point to see if $ZFTP_HOST is set, and if it is, attempts to
close the file. I *think* that all that's changed is the zfclose
was silent before and isn't now, because of tcp_close(). This may be a
knock-on effect of the things above, though, i.e. it goes away if
the session pointers are handled properly.
I hope it's possible to make tcp only return a session pointer if the fd is
valid, and to free the session unconditionally on an attempt to close it.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
next reply other threads:[~2001-09-27 11:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-27 11:30 Peter Stephenson [this message]
2001-09-28 17:23 ` PATCH (partial): " Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10779.1001590249@csr.com \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).