【问题标题】:Issue when closing cassandra cluster and session关闭 cassandra 集群和会话时的问题
【发布时间】:2018-09-22 04:47:18
【问题描述】:

卡桑德拉 2.1.15.1403 | DSE 4.8.9

Cassandra 驱动程序测试:2.1.2 和 3.1.7

我们正在使用 python 脚本来迁移我们其中一个表中的一些数据。完成此操作后,我们将使用以下方法关闭连接:

if (None != self.session):
    self.session.shutdown()
if (None != self.cluster):
    self.cluster.shutdown()

我们在集群关闭时得到以下异常:

DEBUG: Closed socket to 127.0.0.1
DEBUG: Asyncore event loop stopped unexepectedly
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cassandra/io/asyncorereactor.py", line 91, in _run_loop
    asyncore.loop(timeout=0.001, use_poll=True, count=1000)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 220, in loop
    poll_fun(timeout, map)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 145, in poll
    r, w, e = select.select(r, w, e, timeout)
error: (9, 'Bad file descriptor')
DEBUG: Asyncore event loop ended

如果我们删除 session.shutdown 它可以正常工作。有人对此有任何想法吗?

【问题讨论】:

    标签: python cassandra cassandra-2.0 cassandra-driver


    【解决方案1】:

    cluster.shutdown() 已经在执行 session.shutdown http://datastax.github.io/python-driver/_modules/cassandra/cluster.html#Cluster.shutdown 所以我认为没有必要也明确执行会话关闭。

    【讨论】:

    • @Sid: 对此问题有后续跟进吗?
    猜你喜欢
    • 2020-11-20
    • 2017-01-29
    • 2011-07-30
    • 2017-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-28
    • 2013-12-14
    相关资源
    最近更新 更多