Skip to content

API calls spawn threads without releasing them #480

@mkwarman

Description

@mkwarman

Description

API calls seem to spawn threads without ever releasing them. I'm not sure if this is an issue with aiohttp or with how slackclient uses it. Or perhaps I am misusing/misunderstanding the client?

What type of issue is this?

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Reproducible in:

slackclient version: 2.1.0

python version: 3.6.7

OS version(s): Ubuntu 18.04.1 LTS (LXC on Proxmox)

Steps to reproduce:

  1. Post a few messages using slackclient's chat_postMessage or anything that involves an api call.
  2. Run htop or top -H
  3. Observe many sleeping python threads (they are released once the program ends, though, so you'll have to watch while the program is running)

Expected result:

Each API call should make its request and then release/end the thread.

Actual result:

Upon API call completion, sleeping threads are leftover. I think this could be a slow memory leak if many calls are made over time.

Attachments:

image
Code to generate the screenshot above:

import os
import slack
import time
from dotenv import load_dotenv

load_dotenv()

client = slack.WebClient(token=os.getenv("SLACK_TOKEN"))

for x in range(10):
    print("Posting message")
    client.chat_postMessage(
        channel=os.getenv("TEST_CHANNEL_ID"),
        text="Hello from your app! :tada:"
    )

    time.sleep(1)

time.sleep(10)

I also tested running async and got the same result. Please let me know if you need any additional information from me. Thank you for your work on this great client!

Metadata

Metadata

Assignees

Labels

Version: 2xarea:concurrencyIssues and PRs related to concurrencybugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions