Clarify limitations of callbacks

Description

Because callbacks are run in the event loop thread, any blocking operation that would utilize the event loop will hang. For example, using session.prepare() or session.execute() would have this effect. I've attached a basic script to demonstrate the problem.

Unfortunately, the docs aren't clear about this, and a user will simply see the operation hang. At the least, we should improve the documentation. It might also be possible to perform some basic checks for this. For example, checking the thread ID and comparing against the event loop thread's ID in prepare() and execute() might work. However, I'm not sure how expensive that would be, and furthermore, it's difficult to communicate the error to the user. Exceptions that are raised in callabacks are logged and ignored, so the user would only see the exception if they had a try/except wrapper.

Environment

None

Pull Requests

None

Activity

Show:
Adam Holmberg
March 2, 2016, 3:56 PM

This was added some time ago. I guess I didn't recall this ticket:

https://github.com/datastax/python-driver/commit/5ea3f2242fc5af974d4fe119e04f05c4ff8e2ace

Fixed

Assignee

Unassigned

Reporter

Tyler Hobbs

PM Priority

A