Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU Overload with a TCP or MQTT connection/disconnection session. #15

Closed
ralight opened this issue Mar 15, 2016 · 0 comments
Closed

CPU Overload with a TCP or MQTT connection/disconnection session. #15

ralight opened this issue Mar 15, 2016 · 0 comments

Comments

@ralight
Copy link
Contributor

ralight commented Mar 15, 2016

migrated from Bugzilla #485143
status RESOLVED severity normal in component Mosquitto for 1.4
Reported in version 1.4 on platform PC
Assigned to: Roger Light

Original attachment names and IDs:

On 2016-01-04 09:11:22 -0500, Pierre-Yves BOISBUNON wrote:

On windows 7 / 10 /Server 2012 environment,

  • A TCP client connection followed by a disconnection increases CPU loads for a 90s period. This behavior seems to be present in all versions.
  • A MQTT client connection followed by a disconnection increases CPU loads for keepalive time duration x 1.5. This behavior seems to be present from version 1.4.x.

Any idea?

On 2016-01-04 11:09:00 -0500, Roger Light wrote:

What do you mean by a TCP connect/disconnect? A BSD socket connect() followed by close()? Or does e.g. "mosquitto_pub -t foo -m bar" produce this problem for you?

On 2016-01-05 04:35:18 -0500, Pierre-Yves BOISBUNON wrote:

Here is our test sequence:

mosquitto_pub.exe -t 0/rc/10 -m bar -p 5500

1451977925: New connection from ::1 on port 5500.

1451977925: New client connected from ::1 as mosqpub/3516-Pascal_Cha (c1, k60).

1451977925: Sending CONNACK to mosqpub/3516-Pascal_Cha (0, 0)

1451977925: Received PUBLISH from mosqpub/3516-Pascal_Cha (d0, q0, r0, m0, '0/rc/10', ... (3 bytes))

1451977925: Received DISCONNECT from mosqpub/3516-Pascal_Cha

1451977925: Client mosqpub/3516-Pascal_Cha disconnected.

Test OK

Connect Mqtt Client (keepalive : 10s)

1451979015: New connection from 127.0.0.1 on port 5500.

1451979015: New client connected from 127.0.0.1 as 1 (c0, k10, u'1').

1451979015: Sending CONNACK to 1 (0, 0)

1451979015: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

1451979020: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

1451979025: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

1451979030: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

Disconnect

1451979035: Received DISCONNECT from 1

1451979035: Client 1 disconnected.

Test OK

Connect Mqtt Client (keepalive : 10s)

1451978205: New connection from 127.0.0.1 on port 5500.

1451978205: New client connected from 127.0.0.1 as 1 (c0, k10, u'1').

1451978205: Sending CONNACK to 1 (0, 0)

1451978205: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

1451978210: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

1451978215: Received PUBLISH from 1 (d0, q0, r0, m0, '0/rc/1', ... (5 bytes))

Kill Mqtt Client

100% CPU 15s

1451978230: Client 1 has exceeded timeout, disconnecting.

1451978230: Socket error on client 1, disconnecting.

Connect Socket TCP

1451977972: New connection from 127.0.0.1 on port 5500.

Close Socket TCP

100% CPU 90s :

1451978061: Client has exceeded timeout, disconnecting.

1451978061: Socket error on client , disconnecting.

On 2016-01-06 11:38:48 -0500, Roger Light wrote:

Thanks, I'll take a look.

On 2016-01-14 08:49:23 -0500, Pierre-Yves BOISBUNON wrote:

Any update on this issue?

On 2016-01-14 16:21:27 -0500, Roger Light wrote:

Yes, sorry for the delay.

I believe this commit fixes the problem:

http:https://git.eclipse.org/c/mosquitto/org.eclipse.mosquitto.git/commit/?h=fixes&id=SHA: 00491da

Please reopen the bug if you disagree.

On 2016-01-15 05:49:27 -0500, Pierre-Yves BOISBUNON wrote:

Dear Roger

Thank you very much for you fix.

Could you please help to generate a native windows installer?
We do not found any trouble with cygwin based exe.

Thanks,

On 2016-01-15 07:33:09 -0500, Roger Light wrote:

This is set up to work easily with appveyor, so I've just pushed the changes to make it happen.

https://ci.appveyor.com/project/ralight/mosquitto/build/artifacts

The installer there is called 1.4.7, but it actually includes this fix.

On 2016-01-15 08:02:51 -0500, Pierre-Yves BOISBUNON wrote:

Thanks Roger for the installer.
I'm sorry but the issue is still there.
We do not see any change.

On 2016-01-15 10:14:41 -0500, Roger Light wrote:

In that case I can no longer duplicate the bug. What version of Windows are you using? I am on Windows 7.

It might be worth trying to compile yourself. You should use CMake to generate Visual Studio projects. The openssl files you need are at https://slproweb.com/products/Win32OpenSSL.html "Win32 OpenSSL v1.0.2e". You can disable pthreads support because it is only the broker we are worried about for this bug.

On 2016-01-19 08:17:00 -0500, Pierre-Yves BOISBUNON wrote:

Created attachment 259258
VS TCP Test Project

Dear Roger

The problem still exists on Windows 7.
I enclose you the TCP test project related to the TCP part problem of this thread.

Hope it helps.

Thanks.

On 2016-01-19 10:36:06 -0500, Roger Light wrote:

Thanks, I'll take a look on Thursday hopefully.

On 2016-01-20 10:08:40 -0500, Wilfried Chauveau wrote:

Created attachment 259275
add POLLHUP flag to disconnection handling code.

On 2016-01-20 10:10:07 -0500, Wilfried Chauveau wrote:

Hello,

I fixed the issue by adding the flag POLLHUP to (POLLERR | POLLNVAR).

Best regards,
Wilfried Chauveau.

On 2016-01-28 17:09:40 -0500, Roger Light wrote:

Thanks both. I forgot to update this bug after I found the POLLHUP problem myself and pushed an update. I believe it is definitely fixed this time - see the fixes branch again.

@ralight ralight closed this as completed Mar 15, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant