Closed
Bug 69862
Opened 24 years ago
Closed 24 years ago
Close the stream in the destructor of the base classes nsInputStream and nsOutputStream
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: naving, Assigned: naving)
References
Details
Attachments
(2 files)
825 bytes,
patch
|
Details | Diff | Splinter Review | |
2.48 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
CC scc@mozilla.org for review/super-review
Assignee | ||
Comment 3•24 years ago
|
||
cc bienvenu for review. This will help us avoid closing all the
streams individually.
Comment 4•24 years ago
|
||
darin, gordon: what do you think? naving is going to run smoketests and what
not to make sure this doesn't cause any problems. Is |close| idempotent?
Comment 5•24 years ago
|
||
the problem here is that we don't know that the |Close| of any given input
stream or output stream actually is idempotent. Maybe they all must be. But,
if so, it should say so in the IDL files, and it doesn't. Need network expertise.
I understand that this fix is spurred by bad behavior in mail where after
downloading messages with POP, the mailbox can't be compacted because, though
deleted, the stream has not been closed.
Assignee | ||
Comment 6•24 years ago
|
||
Assignee | ||
Comment 7•24 years ago
|
||
The compaction problem that we are trying to solve here concerns filestreams
because they do not relinquish control after they are deleted, this fix
would be a safer fix and will take care of idempotent problem.
Comment 8•24 years ago
|
||
This second patch addresses my concerns. sr=scc
Comment 9•24 years ago
|
||
A |close| method should not, in general, be relied upon to be idempotent. Just
take a look at the close() system call man page on your linux box. EBADF is
what you get if you try to close a file descriptor twice. It seems like bad
code if you end up calling close() more than once.
Comment 10•24 years ago
|
||
r=bienvenu, darin, the second patch addresses your concerns as well, doesn't it?
Assignee | ||
Comment 11•24 years ago
|
||
fix checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 12•24 years ago
|
||
bienvenu: yes
Comment 13•24 years ago
|
||
Wasn't this backed out?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 14•24 years ago
|
||
The bookmarks problem described in #70312 is now fixed.
Comment 15•24 years ago
|
||
To answer Simon's question ... Navin's patch/fix was disabled by commenting out
the close() calls in the destructors he added:
nsInputFileStream::~nsInputFileStream
nsOutputFileStream::~nsOutputFileStream()
That is what fixed the bookmarks truncation problem I believe.
I just checked with LXR and it seems that the close() calls are still commented
out in todays source.
Assignee | ||
Comment 16•24 years ago
|
||
#70312 was just the temporary fix. In preparation for this fix to land again
I checked in a more permanent fix (See #70817)
Comment 17•24 years ago
|
||
Navin: please update us on the state of this bug.
Assignee | ||
Comment 18•24 years ago
|
||
Simon, the fix for this bug was backed out because bookmarks were being deleted
on exit (#70312). I investigated the bookmarks code and checked in the fix
yesterday (#70817) so that when this fix lands again bookmarks don't get deleted.
There was also another issue about cookies (#70316), but I think this fix does
not affect it.
I 'll do some more testing before I land this again
Comment 19•24 years ago
|
||
Cookies code also does stream passing by value. I'm filing another bug on that:
bug 71063
Assignee | ||
Comment 20•24 years ago
|
||
I have done somketest for browser, mail and editor for all three platforms
(mac, linux and win) and everything seems to work fine. Also the bookmarks
issue #70312 (resolved in #70817) and cookies issue #70316 (resolved in #71063)
have been resolved. So I will checkin this patch again. In the second patch,
I will add flush() before I close the stream in ~nsOutputFileStream().
Assignee | ||
Comment 21•24 years ago
|
||
fix checked in again.
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
Comment 22•24 years ago
|
||
Backing this change out as it causes bug 71834.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 23•24 years ago
|
||
Marking this bug invalid as this does not apply to all cases.
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•