Opened 4 years ago

Closed 4 years ago

#1128 closed (fixed)

UPnP daemon memory leak and crash

Reported by: LOM Owned by: BS , Eko
Keywords: Cc:

Description (last modified by LOM)

The current UPnP daemon runs for 17-18 minutes when servicing 6 requests per second (Win XP, alg.exe the Application Layer Gateway). The virtual memory size used by the daemon increases with ~6Kb per second during the time the daemon is up.

The UPnP daemon does not honour the request KEEP-ALIVE, it closes the connection after each request it has serviced. The client application can therefore not use POST to continue communicating, it has to open a new connection. This leaves a lot of CLOSE-WAIT connections in the router.

Change History (10)

comment:1 Changed 4 years ago by LOM

  • Description modified (diff)

comment:2 Changed 4 years ago by frater

I hope this will get some attention...

comment:3 Changed 4 years ago by BrainSlayer

sounds like your service misses to close the connection and this will increase the memory usage for sure every time you open a connection without closing it.

comment:4 Changed 4 years ago by BrainSlayer

  • Resolution set to fixed
  • Status changed from new to closed

i hope its fixed with r12291

comment:5 Changed 4 years ago by Blazian

  • Resolution fixed deleted
  • Status changed from closed to reopened

Your fix did nothing for us BS, it actually made it worse. I no longer see UPnP working at all on the web GUI in build 12291.

comment:6 Changed 4 years ago by Blazian

Please reverse 12291 UPnP fix.

comment:7 Changed 4 years ago by LOM

Thanks for the effort BS, here is some additional and hopefully better info for you:

The 6 requests per second from the ApplicationGatewayLayer? monitor program are:

  1. GetStatusInfo? (ConnectionStatus?, ConnectionError?, UpTime?)
  2. GetTotalBytesSent?
  3. GetTotalBytesReceived?
  4. GetTotalPacketsSent?
  5. GetTotalPacketsReceived?
  6. GetCommonLinkProperties? (WANAccessType, LayerUpstreamMaxBitRate?, LayerDownStreamMaxBitRate?, PhysicalLinkStatus?)

and it is GetStatusInfo? that causes VSZ to grow. I have used UPnP tester from www.noeld.com, VSZ grows with 4Kb each time I request WANIPConnection/GetStatusInfo. 4Kb per second during 17 minutes = 4100 Kb and that is also what I see in the top command. The daemon starts with VSZ ~1800Kb and crashes with VSZ ~5900Kb.

The request LANHostConfigManagement/GetReservedAddresses crashes the daemon immediately so you may want to either remove that capability or fix it.

The request LANHostConfigManagement/GetDNSServers replies with NewDNSServers, I am using dnsmasq as local dns server so expected to get the routers address. I can't find the variable lan_dns or lan%d_dns in the nvram..

comment:8 Changed 4 years ago by LOM

  • Owner changed from somebody to BS , Eko
  • priority changed from major to critical
  • Status changed from reopened to new

comment:9 Changed 4 years ago by LOM

Maybe close the file *fp in upnp_osl_wan_uptime()

comment:10 Changed 4 years ago by LOM

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.