I'm working on an IRC implementation in C#. My work is based off of IRC.NET, and I have this problem that keeps cropping up. According to wireshark, my session is almost identical to X-Chat, where the problem does not occur. The problem in question is that after about 10 minutes of perfect operation, it stops working out of nowhere. No exceptions occur, but the bot is unable to send messages and sees nothing from the server. I respond to pings and such appropriately. After a while, the server (FreeNode) reports that the bot has pinged out, but the client knows nothing of it.
It is a very frustrating bug, and I have no idea what is causing it.
EDIT:
Here are some relevant links:
Library my work is based on (I have made very few changes)
The bulk of the relevant code is in IrcClient.cs
Here's most of my code for working against the library: Link
Have you considered that it might be due to garbage collection? It would be good to see if you can establish whether or not your server or timer objects are being collected
Related
Working with QuickFIX/n and need to find a way to monitor potential crashes on the executor side (I am developing the client side). I see there is logging when a connection stops but no way of tracking and triggering anything in the code.
I have looked at Quickfix/n - No event for connection timeout or host not found? but it only addresses initial connection, not crashes post connection. QuickFIX/J has SessionStateListener https://quickfixj.org/javadoc/1.6.4/quickfix/SessionStateListener.html but not finding anything similar in the C# variant.
Basically, need to find a way to create an observer but do not see anything built in that could be of use.
This isn't a definitive solution but ends justify the means for now.
Have created own implementation of the ILogFactory (rather than use builtins) and it listens to the message containing " disconnecting: " then sends info to applicable services. Causes some strange coupling but currently not seeing a clean way like the java implementation does it.
Hey i recently created a text message application in c# that sends messages back in forth in a console. I used NetworkCommsDotNet & NetworkCommsDotNet.Connections.
When i was researching about it i found a command NetworkComms.Shutdown() http://www.networkcomms.net/api/html/M_NetworkCommsDotNet_NetworkComms_Shutdown.htm
I'm also new to programming so i really didn't completely understand what they where saying and was still left wondering if I don't use this in my program, will it break something or mess up my router in any way?
ps - the program works and i had success with testing it between two computers on my home network.
I haven't used this, nor even know what it is, however i am good at reading documentation and believe what they tell me (for the most part)
Shutdown all connections, threads and execute OnCommsShutdown event.
Any packet handlers are left unchanged. If any network activity has
taken place this should be called on application close.
The reason why its telling you this, is that is most likely using unmanaged resources, and most likely wants to gracefully shut them down or clean them up. Since there is no open source for this project, we can only listen to what its telling you
I have problem in refreshing data in a Windows Forms application. I have one server (it is also an other client) and one client. My task is to update data in list by clicking on button and server side client is updating properly, but in client it is not updating for the first time.
But by keeping debug point on particular point it is updating on client side also. I understood that this is happening because of Timing issue, so I used Thread.Sleep();.
But still I am facing the same problem.
I am not able to understand why this is happening without changing any code.
Do not ever -EVER- use Thread.Sleep(); This is just something you do when you're trying out stuff but has pretty much no use in production.
That being said, you're experiencing a race condition, which are usually annoying to debug because they depend on server-client communications.
I suggest you take a look at async-await, if you haven't already, and you set your code so you wait (await) for the server to give you the update before updating your UI.
If you're already using async/await I suggest you show us some code so we can at least help you out a little. But with the information currently available, I suggest you look this up and learn a bit from there. It'll help a lot
I am writing a UWP app using the Windows.Devices.WiFi to basically get a lists of networks. Everything was working fine when I retrieved the information a time or two. However, I wanted to put the code into a timer so I can report regularly. Once I did this, I got "an attempt was made to establish a session to a network server, but there are already too many sessions established to that server."
I am not sure what is establishing connections as I am just trying to read the information. I am not even calling the ConnectAsync calls.
Can anyone help me out? I need to know what to dispose, or close, etc.
Update: Further analysis, I am finding that the call to FindAllAdaptersAsync multiple times is causing this issue.
I decided to cache up the list of adapters by only calling FindAllAdaptersAsync once. Thanks for the idea Henk. This seemed to fix my issue for now. However, I think that it is a bug with FindAllAdaptersAsync. I would think you should be able to call this as much as you like, unless maintaining the network connection is necessary every time. Or at least a way to free them up.
Here is my problem:
I have just been brought onto a massive asp.net C# project and I've been charged with fixing some performance issues (not my area of expertise). More specifically after 5 - 7 redirects/ajax calls the web server stops responding and the whole page (and eventually the browser) freezes.
I don't think this is a coding issue as I've set up break points in a few pages (Page_Load method) and after the 5 requests it does not even reach the break points.
I don't believe this is related to this issue as I've increased the browser's maximum connections per server parameter and I got the same behavior. Furthermore after these 5 request in one browser IE, the application stops working in FF as well.
This is not a resource issue as the w3wp.exe process never exceeds 500MB memory.
One thing I've noticed when using Fiddler and other tools to monitor the requests is that the server takes a very long time when loading image files (png, jpg). I don't know if this is relevant.
I've enabled failed request tracing on the server and the only thing I've noticed is that some request fail with a 401 error even dough I've set Anonymous Authentication to enabled.
Here is the exact message
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName ManagedPipelineHandler
Notification 128
HttpStatus 401
HttpReason Unauthorized
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)
This message is sometimes thrown with ModuleName: ScriptModule
I have already wasted 2 days on this thing and I'm running out of ideas so any suggestions would be appreciated.
Like any large generic problem, your best bet in diagnosing the issue is to figure out how to break down the issue into smaller parts, how to hypothesize the issues, and how to validate or invalidate your hypotheses. My first inclination would be to hypothesize that the server-side processes in this particular are taking a long time, causing your client requests to block, making the whole thing seem frozen.
From there, I would attempt to replicate the long running server side processes by creating isolated client side tests - perhaps if the URLs are HTTP gets, I would test the same URLs individually. If they were HTTP posts, I'd create an isolated test form if feasible to see what happens with each request. If a long running server side process is found then you have a starting point.
If there are no long running server side processes then it may be JavaScript / client side coding issues that need to be looked into. But definitely when you're working a large, unfamiliar project, your best bet is to figure out how to break down the issue into smaller components that can then be tested
I solved the issue finally. Here is what I did:
Experimented with IIS settings and App_Pool recycling and noticed that there is nothing wrong with the way it handles requests that actually reach it.
I focused on the Http.sys module and noticed that in the log files there were a lot of Timer_ConnectionIdle and Client_Reset errors.
After some more experimentation and a lot of Google searches, I accidentally found this answer and it solved my issue. As the answer suggests the problem was caused by the AVG antivirus installed and incorrectly configured on the server.
Thanks for all the help and suggestions.
If it's ajax calls that are causing your browser to freeze, make sure they are not blocking ajax calls.
Just appending to Shan's answer, which is a good one.
First off, there is obviously a code issue as this is by no means 'normal' behavior for IIS.
That said, you must isolate it as Shan indicated. For example, given the server itself no longer accepts connections then we can pretty well eliminate javascript as the source of the problem and relegate it to being just a symptom.
Typically when a worker process spins into space like this it is due to either an infinite loop or an issue where multiple threads are trying to lock the same resource. I bet if you let it run long enough IIS itself will timeout, kill and restart the process.
With that in mind you want to look for any type of multithreaded garbage (which I highly recommend you don't do in a web server) or for anything that indicates a tight infinite loop. A loop is going to become apparent if you execute the requests individually. A multi-threaded issue will only show up if you happen to get a collision.
Run various performance counters on the web server. Also, once it locks up, let it sit that way for awhile. Once IIS performs it's own reset on the worker process go look for indicators in the event log.