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

windows下,aqmtt服务占用的内存能自动释放,但linux一直释放不了。 #75

Open
linshengbin opened this issue Sep 24, 2021 · 9 comments

Comments

@linshengbin
Copy link

windows下,aqmtt服务占用的内存能自动释放,但linux一直释放不了。

@HerrMuellerluedenscheid
Copy link
Contributor

From google translate: Under Windows, the memory occupied by the aqmtt service can be automatically released, but Linux has not been able to release it.

@linshengbin can you provide some more detail or information on the issue?

@linshengbin
Copy link
Author

linshengbin commented Sep 24, 2021 via email

@sjlongland
Copy link
Contributor

python 3.4.3

Wow, I don't think amqtt is going to work at all on such an old release of Python with its heavy-use of type annotations and async/await.

@linshengbin
Copy link
Author

linshengbin commented Sep 26, 2021 via email

@sjlongland
Copy link
Contributor

(via Google Translate)

@.***/yield from. Because the HBMQTT open source project community has not been updated. So I can only ask questions through this side.

Yeah, it's fair to say, hbmqtt is pretty much history now. Of course, it's an open-source project, as is amqtt; so nothing stopping you or anybody else forking the code and fixing it, but I wouldn't hold my breath on fixes to amqtt being backported to hbmqtt.

Linux (none) 3.10.108-rt80-Cavium-Octeon+

That implies this is some sort of embedded device (router perhaps) … maybe the build environment needs re-jigging to do it, but python3.7 does work in such environments.

@FlorianLudwig
Copy link
Member

@linshengbin could you share the code you use for load-testing?

So we could reproduce it

@linshengbin
Copy link
Author

linshengbin commented Sep 26, 2021 via email

@linshengbin
Copy link
Author

linshengbin commented Sep 26, 2021 via email

@sjlongland
Copy link
Contributor

Also, small tip (which applies to amqtt in general too, I see the pattern there in lots of places):

            try:
                # … etc …
                pass
            except ConnectException as ce:
                logger.error("Connection failed: %s" % ce)

Not the best way to log an exception for two reasons:

  1. % always formats the string, whether logger is configured to emit logs at error level or not
  2. you miss out on the stack trace, which can be real handy for troubleshooting

logger.error("Connection failed: %s", ce) addresses (1) whilst ignoring (2). The logging module has the exc_info keyword argument, which pretty much will do this for you… I'd write the above as:

            try:
                # … etc …
                pass
            except ConnectException:
                logger.error("Connection failed", exc_info=True)

Or, for error, there's a shortcut:

            try:
                # … etc …
                pass
            except ConnectException:
                logger.exception("Connection failed")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants