Solved

WSAENOBUFS reason ?

Posted on 1998-12-16
27
782 Views
Last Modified: 2013-12-03
On one computer, my program using sockets returns the following error when trying to connect as a client to a remote host.

WSAENOBUFS The Windows Sockets provider reports a buffer
deadlock.

If I retry this connect call it may at some point succeed.
I have no idea how to solve the problem.
Is there an NT parameter I could tweek to solve the problem ?

Apparently it sounds like a memory limitation problem !
But what memory ? I have 64 Mb and OS is NTServer.
0
Comment
Question by:meessen
  • 9
  • 7
  • 5
  • +2
27 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1417351
Wht else is going on with this system?  It's very possible that you really have run out of memory allocated for network communications.  First, 64MB is minimal for NT Server.  Are the other computers you are running this application on configured similarly?  If so, are they running the same other apps or services?  If for instance, this machine is running a WWW server or mail server that could be hogging up the network buffers.  The fact that it will eventually come back with and work leads me to believe that this is the problem.

There is a regsitry setting to force more network buffer space to be set aside but I can't find it just now.  If I can locate it, I'll post an answer.  Otherwise, I'm sure someone else will jump on this.
0
 
LVL 1

Author Comment

by:meessen
ID: 1417352
Great comment. I also just found out in documentation that it means in fact that there is not enough memory. It is also reported as a bug in older Win95 versions because some heap would not grow.

I really don't know what can use up network memory. We don't have mail server, etc.
We don't have a user on this computer. But we have shared disk... it's our server.
This host has a raid card which may use up physical memory reserved for system.

So this sounds more like an NT configuration problem.

This problem might bogged down the server for network access. We would like to solve this problem.
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1417353
I had a similar problem with Win95/98.
My problem was a setting within the registry.
I don't know if NT has the same setting but it may be worth a try....
HKEY_LOCAL_MACHINE
System
CurrentControlSet
Services
VXD
MSTCP

in the MSTCP folder:
add:   MaxConnections with a string value of 500 or even higher.
I'm not quite sure how high it can go but 500 works for me.
It is important that it is a STRING value.  All documentation points to a DWORD
but a DWORD value won't work, it has to be a STRING.

Let me know if this helped...

J.R.
0
 
LVL 1

Author Comment

by:meessen
ID: 1417354
I'm running NT server 4.0 SP3

There is a VXD entry but no MSTCP entry.
I'm afraid your solution doesn't apply in my case <sight>

0
 
LVL 11

Expert Comment

by:alexo
ID: 1417355
Try using regedit to seararch for "MaxConnections"
0
 
LVL 1

Author Comment

by:meessen
ID: 1417356
Not found
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1417357
Try Adding the MSTCP folder then the MaxConnections etc....??
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 1417358
In the registry at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters\Winsock

add 3 new DWORD entries:

InitialLargeBufferCount
InitialMediumBufferCount
InidialSmallBufferCount

Give them values of 10, 30, and 50 respectively.  If this doesn't help, try bumping them up by about 10% each a few times.

Please note that you must reboot NT after changing any of these before they will take effect.
0
 
LVL 1

Author Comment

by:meessen
ID: 1417359
BINGO !

The given values solved the problem. I would say I had the impression that it would run even faster. Is this possible ?

What do these parameter mean ?
Is it possible to increase transmission performance by increasing these buffer values ?
Are there any other parameters that might increase TCP transmission ?


We are evaluating NT for transferring many 1MB bloc of data. In the six test I just did in a row I got 9MB/s 2 times and four times 6.6 MB/s. Why do I get such low performances at some occasions ? Do you have other magical parameters that might help us ?

Beside when I send these 1MB blocs to another process on the same computer I have at best 9MB/s but with Solaris on the same computer and hardware (3Com 10/100 card) I get 20MB/s between process on the same computer. Do you have clues for these and other parameters to set ?

Anyway thanks a lot for your help at least we can now run our performance tests.

I increased the score to 200 points, you deserved it.

I have to save some for the next questions ;-)

0
 
LVL 32

Expert Comment

by:jhance
ID: 1417360
You can increase these values as much as you want to.  But there _IS_ a cost.  These are taken away from the hard memory available to NT.  As so often is the case, it's a tradeoff.  If this machine is not doing much else, then bumping these up will probably not affect much else.
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1417361
jhance -
Do those values work with Win95/98?   or is it just an NT entry?

J.R.
0
 
LVL 32

Expert Comment

by:jhance
ID: 1417362
No, these are NT only.  I think that there are some similar settings for Win9x but I'm not sure what they are.  You need to refer to the Windows 95 Resource Guide.
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1417363
Thanks,  I had settings that would do it, it just looked like those worked better than what I had.

'preciate it..

J.R.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:bryan7
ID: 4330400
is anyone still here ?
I have the same problem.. but I run win 95 OSR2 with winsock 2, MSDUN 1.3, and have 256 MB RAM !
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4330401
the problem raises when about 35...40 clients connect
0
 
LVL 1

Author Comment

by:meessen
ID: 4338076
Hello,

Yes, I'm still here.
Problem was solved by increasing memory. Went from 64Mb to 128Mb.

There is also a known feature that when programs don't properly close sockets, there is a system memory leak.

So a first step would be to increase memory. A second is to make sur if possible that sockets a properly closed.

The meaning of the problem is that a request to allocate internal buffers failed most probably because memory was exhausted.

Hope this helps..
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4349614
yo.. I have 256 MB of RAM !

about closing sockets.. I get this error before closing any socket..
Anyway when my app is closed.. I can connect all those 35..40 sockets again so my app closes them properly.
0
 
LVL 1

Author Comment

by:meessen
ID: 4351712
Ok about memory but you should check if you don't have a memory leak that exhaust memory rappidly.
Check memory usage. On NT you have a monitoring tool allowing to check memory usage to see if it remains stable.

The problem appeared when trying to connect. In that case the socket library needs to alocate some buffers and if it fails it returns the specified error message.

Of cours such message may not appear at socket closing.
I would say that there is 95%$ chance that the problems occurs because there is not enough memery. Though I don't  have the source code to check what exactly can produce this error.

The problem we found is that when program crashes or are killed from outside, their system resource may not be freed properly.  Thus after some time, system memory becomes rare and soon or later it will complain.


To check this, try to see if the error message does still appear after a reboot. Normally it should solve the problem for some time. If it comes from a memory leak, the longer you have to wait to see it appear again, the smaller the memory leak is.

If the problem appears every time you run you application even if you just rebooted your PS, then the problem source may be different or you have a serious memory exhaustion problem.

Could you describe all the tests you have made ?
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 4354094
Doesn't Win95/98 only allow you to use up to 128 mg of ram regardless of how much you put in the machine.  I was told that at some point.
0
 
LVL 32

Expert Comment

by:jhance
ID: 4355577
jrmcg,

This is simply not true.  You are confusing an issue with some very early motherboards and Win95 where the memory hardware was incapable of handling caching for more than 64MB of RAM.  The system could use more, but without a working cache for that part of it, the performance was dismal.  This is NOT an issue today for any system other than a very few relics.

You may also be confusing the RAM vs. RESOURCES issue that both Win95 and Win98 suffer from.  Regardless of how much available RAM you have on a Win9x system, the RESOURCES are limited to 64K on Win95 and 128K on Win98.  This is due to the need to maintain compatibility with 16-bit Windows apps.  So you may have 512MB of RAM on your system but still run out of RESOURCES with only a few apps running.  It depends on how the different apps use up resources which is NOT the same as memory usage.

In any case, it is _not_ true that a Win98 system is limited to 128MB of RAM.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4362481
um btw, those 35 must be70.. since I'm connecting to localhost to make the tests each connection means 2 connections.

stats when problem occurs ( at about 35 connetions )

Allocated Memory: 168.8 Mb
Free Memory: 107.9 Mb
Swapfile in use: 0
Swapfile size: 0
Disk cache size: 66.6 Mb
Kernel Threads: 36

Resources:
System: 60% free
User: 63 % free
Gdi: 60% free

I've made some tests with another apps (not mine) and the same problems occurs at 35..40 connections.. so it's my app's fault.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4362572
"To check this, try to see if the error message does still appear after a reboot."

when I close my 2 apps (same app, ran twice.. one makes as server and the other connects to the server) and run them again I can connect all the sockets again.. with no need to reboot
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4362593
"I've made some tests with another apps (not mine) and the same problems occurs at 35..40 connections.. so it's my app's fault. "

missed a NOT there.. "it's not my app's fault"
0
 
LVL 1

Author Comment

by:meessen
ID: 4367298
This mean you may have reached a socket library limitation.
You said you run on win95.

Have you tried your app on an NT computer ?

Would it be possible to have a look at it and trying it on my local computer ? I have NT4.0 and NT2000. So we could check if system is making a difference.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 4369700
umm that would be great.. what's you email ?

thanks
0
 
LVL 1

Author Comment

by:meessen
ID: 4370999
chrisophe@meessen.net
0
 
LVL 1

Author Comment

by:meessen
ID: 4371470
chrisophe@meessen.net
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now