Opened 6 years ago

Closed 6 years ago

#12395 closed Bug Report - General (fixed)

SSDP thread uses 100% CPU

Reported by: Warren Falk <warren@…> Owned by: stuartm
Priority: critical Milestone: 0.27.5
Component: MythTV - UPnP Version: 0.27-fixes
Severity: high Keywords:
Cc: Ticket locked: no


On both backend and frontend, the SSDP thread after a few minutes or hours will jump to 100% CPU and never come down.

I discovered this to be caused by a zero byte UDP packet (that some badly designed UPNP device on my network must be sending).

This can be reproduced using the following C program:

#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char**argv)
   int sockfd,n;
   struct sockaddr_in servaddr,cliaddr;
   char sendline[0];


   servaddr.sin_family = AF_INET;

   int len = 0;
   printf("Send %d bytes\n", len);
   sendto(sockfd,sendline,len,0,(struct sockaddr *)&servaddr,sizeof(servaddr));

And then running the following (on the backend, just for example)

top -H -p `pgrep mythbackend`

Change History (5)

comment:1 Changed 6 years ago by Warren Falk <warren@…>

I have a fork of fixes/0.27 and have coded a fix which works. I will create a pull request, but I've never submitted code to the project before.

I cannot easily test on master because this installation is currently in use. I believe the problem still exists there, and should be easily reproducible using the file in the description.

The requirements for submitting tickets and code to this project are pretty daunting for a first timer. Take it easy on me.

comment:2 Changed 6 years ago by stuartm

Milestone: unknown0.27.5
Owner: changed from dblain to stuartm
Priority: minorcritical
Severity: mediumhigh
Status: newaccepted

comment:3 Changed 6 years ago by Stuart Auchterlonie

There's an open pull request for this

comment:4 Changed 6 years ago by Warren Falk <warren@…>

In 628183a01b66a010e9cf510b9d1d08a348ed5889/mythtv:

fix SSDP thread using 100% CPU on zero byte datagrams

Refs #12395

Signed-off-by: Stuart Morgan <smorgan@…>

comment:5 Changed 6 years ago by Warren Falk <warren@…>

Resolution: fixed
Status: acceptedclosed

In 4adfeffe264a67425f459c5b76cfce79a29db356/mythtv:

fix SSDP thread using 100% CPU on zero byte datagrams

Fixes #12395

Signed-off-by: Stuart Morgan <smorgan@…>

Note: See TracTickets for help on using tickets.