Skip to content

Intermittent Connection Failure #386

Description

@chirdeeptomar

I am connecting to solr cluster using SolrCloud with Kerberos authentication is enabled. We are getting connection failures every next day after the app is not used overnight.

2022-09-08 16:56:13,754 - kazoo.client - WARNING - Connection dropped: socket connection error: Connection refused

We then decided to open and close connection on every request but something the problem remains.

@contextmanager
def open_connection(collection) -> pysolr.SolrCloud:
    """create Pysolr connection"""
    os.environ["KRB5_CLIENT_KTNAME"] = KEYTAB
    solr: pysolr.SolrCloud = None
    try:
        logger.info("Opening solr connection")
        zookeeper = pysolr.ZooKeeper(ZOOKEEPER_URL)
        kerberos_auth = HTTPKerberosAuth(principal=PRINCIPAL, force_preemptive=True)
        solr = pysolr.SolrCloud(
            zookeeper,
            collection,
            auth=kerberos_auth,
            verify=False,
            search_handler="/select",
        )
        yield solr
    finally:
        if solr:
            logger.info("Closing solr connection")
            solr.get_session().close()

Configuration

  • Operating system version: RHEL 7.3
  • Search engine version: 8.6
  • Python version: 3.6
  • pysolr version: 3.9.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions