Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-25106

A new Kafka consumer gets created for every batch

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete CommentsDelete
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.3.1
    • None
    • Structured Streaming
    • None

    Description

      I have a fairly simple piece of code that reads from Kafka, applies some transformations - including applying a UDF - and writes the result to the console. Every time a batch is created, a new consumer is created (and not closed), eventually leading to a "too many open files" error.

      I created a test case, with the code available here: https://github.com/aseigneurin/spark-kafka-issue

      To reproduce:

      1. Start Kafka and create a topic called "persons"
      2. Run "Producer" to generate data
      3. Run "Consumer"

      I am attaching the log where you can see a new consumer being initialized between every batch.

      Please note this issue does not appear with Spark 2.2.2, and it does not appear either when I don't apply the UDF.

      I am suspecting - although I did go far enough to confirm - that this issue is related to the improvement made in SPARK-23623.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned Assign to me
            aseigneurin Alexis Seigneurin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment