mIRC Homepage

Quitting not working properly

Posted By: Xycaleth

Quitting not working properly - 20/05/12 12:18 PM

Probably something you won't notice unless someone else tells you. I'm running mIRC 7.22, and whenever I quit mIRC, the server always gives the quit reason as "Input/output error". I've tried closing by clicking the X button in the title bar, Alt+F4 and File>Quit, and all 3 give the same problem.

Not really a major bug but thought I would report it anyway!

EDIT: Only seems to happen sometimes? Now I've tried it a few more times it seems to happen sporadically...
Posted By: gbz

Re: Quitting not working properly - 20/05/12 02:23 PM

I've seen this happening for years. To my knowledge it occurs whenever an SSL connection is ended with /disconnect rather than /quit. Quitting mIRC in the ways you described sends a /disconnect, so that should be why you (or others) are seeing that "Input/output error" message when you are terminating an SSL connection.

This issue has been around as long as I can remember, probably ever since mIRC got built in SSL support. I reported it many years ago, but unfortunately never received any replies.

I'm not sure if mIRC or OpenSSL is to blame for this, but I do know that back in the days before mIRC had SSL support, I was using Stunnel and StunTour for SSL connections, and with at least one of them, I didn't see this issue when using /disconnect.
Posted By: Khaled

Re: Quitting not working properly - 20/05/12 09:12 PM

Thanks for your post. This issue is due to the way mIRC performs a hard disconnect from a server. It applies to both SSL and non-SSL connections.

When you disconnect from the server, or use /disconnect, mIRC sends a QUIT message to the server and then closes the connection immediately. In some situations, this may prevent the server from seeing the QUIT message which can result in the issue you describe.

Many versions ago I changed mIRC to perform a soft disconnect, similar to using the /quit command, where it would send the QUIT message and then wait for confirmation of the closed connection, and any close or quit messages, from the server. If no confirmation was received within a few seconds, mIRC closed the connection automatically. Unfortunately many users complained about the behaviour, so it was removed in a subsequent version of mIRC.
Posted By: gbz

Re: Quitting not working properly - 21/05/12 11:48 AM

Originally Posted By: Khaled
It applies to both SSL and non-SSL connections.

Hmm. I have been dealing with this issue since mIRC introduced SSL support and have never once seen this happen on an unencrypted connection, no matter how I disconnected it (usually by clicking the disconnect toolbar button or closing mIRC using the X in the upper right corner).

Using SSL on the other hand, I can pretty much reproduce this issue at will: When I terminate such a connection in the ways described above, "Input/output error" shows up about 9 times out of 10. This is why I've always thought it must be related to SSL being "in between" things and possibly not forwarding the quitmsg correctly.

Is there really nothing that can be done except use /quit to close secure connections? I'd be glad to help track this down if there's anything I can do/test.
Posted By: argv0

Re: Quitting not working properly - 21/05/12 02:28 PM

In short, you've been lucky. I imagine an SSL teardown is slightly slower than a regular connection, or, slow enough that you get caught up every now and then (in your case, more times than not). Your connection just happens to be such that a normal connection quits just in time, but an SSL connection is just beyond that threshold.

As Khaled said, there's nothing else to track down, the underlying cause of this issue is well known and expected in the case where /disconnect is used-- and it was explained why mIRC behaves this way.
Posted By: Xycaleth

Re: Quitting not working properly - 22/05/12 11:41 AM

Were the complaints due to the window taking longer than usual to visibly close? It seems to me you could close the window, while leaving the connection active until the confirmation was received, or until a timeout was exceeded (thereby closing the connection automatically).

In any case, thanks for clearing this up for me.
Posted By: pishposh

Re: Quitting not working properly - 22/05/12 11:51 PM

Just an idea... but since this never stops coming up, here's a way the issue could be resolved that might satisfy both groups of people:

1) Let /quit continue to wait indefinitely for server disconnection confirmation (as it does now)

2) For legacy script compatibility, let /disconnect continue to force immediate hard disconnects; however, add an -s switch which forces /disconnect to attempt a soft disconnect for 3-4 seconds (so scripts may invoke such behavior if desired).

3) For closing mIRC itself: add an "attempt soft disconnect upon close" ALT-O option. If unchecked, "/disconnect" behavior occurs when closing mIRC. If checked, "/disconnect -s" behavior occurs when closing mIRC, and this box appears when the soft disconnect attempt begins:

| Exiting                       |
| Logging out of server(s)...   |
|                               |
|         [ Close Now ]         |

This way mIRC closes after 3-4 seconds if the server doesn't respond (as with many versions ago), but users who don't know about (or bother to learn of) the ALT-O option have a "bailout" button to force immediate closure.
Posted By: argv0

Re: Quitting not working properly - 23/05/12 07:29 AM

The problem has to do with a lot of underlying issues, I think. Hiding the window just hides the symptom, not the problem. I could be wrong, but the complaints were coming from the fact that mIRC corrupts data (scripts, logs) if it takes too long to close during a shutdown. In this case, Windows will forcibly kill the process, screwing with the way mIRC keeps file handles open to scripts/logs, and corrupting data. This is still an occasional complaint, but I imagine if mIRC used to stay open longer, it was probably a bigger issue and prompted the reversion.
Posted By: argv0

Re: Quitting not working properly - 23/05/12 07:33 AM

Last I checked, Khaled was trying to minimize the number of options, not add more. Adding a switch for every minor detail about program function is fun for users, but not for the maintainer. I personally don't think this is a big enough deal to warrant a setting, let alone command switches.

If you're doing this in a script, you can just not use /disconnect, anyway. No need to add a switch to make /disconnect behave like /quit when you can just /quit.

By the way, there is already an "exit confirmation" dialog that pops up on exiting (by default). Your proposal would add yet another dialog, making for a pretty ugly UX. There would now be two boxes to click if they wanted to exit and bailout. They could change options, but this is what new users will be seeing.
© 2022 mIRC Discussion Forums