Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Docker container does not stop running after Data Prepper shuts down #3141

Open
kartg opened this issue Aug 10, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@kartg
Copy link
Member

kartg commented Aug 10, 2023

Describe the bug
I'm using the Docker version of Data Prepper (opensearch-data-prepper:2.4.0-SNAPSHOT) built from source (./gradlew :dockerSolution:buildDockerImages). When using a pipeline that includes an Opensearch source, invoking Data Prepper's shutdown API appears to terminate the Data Prepper server but does not stop the Docker container.

Snippet of Data Prepper logs:

...
Found openjdk version  of 17.0
2023-08-10T23:16:46,589 [main] INFO  org.opensearch.dataprepper.parser.PipelineParser - Building [opensearch] as source component for the pipeline [test-pipeline]
....
2023-08-10T23:16:46,940 [main] INFO  org.opensearch.dataprepper.parser.PipelineParser - Building [opensearch] as sink component
....
2023-08-10T23:16:47,223 [main] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Initiating pipeline execution
....
2023-08-10T23:16:47,488 [main] INFO  org.opensearch.dataprepper.pipeline.server.DataPrepperServer - Data Prepper server running at :4900
....
2023-08-10T23:16:48,143 [test-pipeline-sink-worker-2-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Submitting request to initiate the pipeline processing
....
2023-08-10T23:16:51,810 [pool-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Received shutdown signal with processor shutdown timeout PT30S and sink shutdown timeout PT30S. Initiating the shutdown process
....
2023-08-10T23:17:21,813 [pool-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Shutting down processor process workers.
....
2023-08-10T23:17:23,026 [pool-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Shutting down sink process workers.
2023-08-10T23:17:23,027 [pool-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [test-pipeline] - Pipeline fully shutdown.
2023-08-10T23:17:23,057 [pool-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.server.DataPrepperServer - Data Prepper server stopped

Command line:

$ docker ps
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS          PORTS                    NAMES
08319e699cae   opensearch-data-prepper:2.4.0-SNAPSHOT   "/entrypoint.sh bin/…"   23 minutes ago   Up 22 minutes   0.0.0.0:4900->4900/tcp   epic_jackson
$ docker top 0831
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                48665               48639               3                   23:16               ?                   00:00:43            java -Dlog4j.configurationFile=/usr/share/data-prepper/config/log4j2-rolling.properties -Ddata-prepper.dir=/usr/share/data-prepper -cp /usr/share/data-prepper/lib/* org.opensearch.dataprepper.DataPrepperExecute
root                49046               48639               0                   23:19               ?                   00:00:00            /bin/bash

Pipeline configuration:

test-pipeline:
  sink:
  - opensearch:
      bulk_size: 2
      document_id_field: getMetadata("opensearch-document_id")
      hosts:
      - [redacted]
      index: ${getMetadata("opensearch-index")}
      password: [redacted]
      username: [redacted]
  source:
    opensearch:
      disable_authentication: true
      hosts:
      - [redacted]
      indices:
        exclude:
        - index_name_regex: \.*
        include:
        - index_name_regex: [redacted]
        - index_name_regex: [redacted]

This is possibly an issue only with the opensearch source plugin - I used the following pipeline and the Docker container stopped correctly (the sink endpoint in both cases is the same).

http-test-pipeline:
    source:
        http:
    sink:
        - opensearch:
            hosts: [redacted]
            username: [redacted]
            password: [redacted]
            index: "httptest"

To Reproduce
See above

Expected behavior
The Docker container stops after the Data Prepper server has shut down

Screenshots
N/A

Environment (please complete the following information):

  • OS: MacOS 12.6.6
  • Version: Data Prepper 2.4.0-SNAPSHOT

Additional context
N/A

@kartg
Copy link
Member Author

kartg commented Aug 10, 2023

Additional info:

After the Data Prepper server stopped log line above, API calls to the Docker process are not responsive i.e. there is no longer a process listening on the port

I've also attached a jstack dump that i took on the Docker container:
jstack_3141.txt

@kartg
Copy link
Member Author

kartg commented Aug 16, 2023

I was able to repro the same behavior outside Docker (using the binary from ./gradlew build). Pipeline configuration remained the same.

jstack dump - jstack_dump_2.txt

@dlvenable dlvenable added this to the v2.5 milestone Aug 16, 2023
@dlvenable dlvenable moved this from Unplanned to To do in Data Prepper Tracking Board Aug 16, 2023
@dlvenable dlvenable modified the milestones: v2.5, v2.6 Oct 6, 2023
@dlvenable dlvenable removed this from the v2.6 milestone Oct 23, 2023
@dlvenable
Copy link
Member

dlvenable commented Oct 23, 2023

I'd check to see if the opensearch source has any background threads that might not be shut down. By default, Java threads are not daemon threads, so these may interrupt the shut down.

kartg added a commit to kartg/opensearch-migrations that referenced this issue Dec 20, 2023
The orchestrator now suppresses exit code 143 if it is returned by the migration monitor, since this is a result of a workaround for opensearch-project/data-prepper#3141 .
Unit tests have been added to cover this scenario. This change also ensures that a return_code is always returned by the function, and updates some stale comments.

Signed-off-by: Kartik Ganesh <[email protected]>
kartg added a commit to kartg/opensearch-migrations that referenced this issue Jan 17, 2024
The orchestrator now suppresses exit code 143 if it is returned by the migration monitor, since this is a result of a workaround for opensearch-project/data-prepper#3141 .
Unit tests have been added to cover this scenario. This change also ensures that a return_code is always returned by the function, and updates some stale comments.

Signed-off-by: Kartik Ganesh <[email protected]>
kartg added a commit to kartg/opensearch-migrations that referenced this issue Jan 19, 2024
The orchestrator now suppresses exit code 143 if it is returned by the migration monitor, since this is a result of a workaround for opensearch-project/data-prepper#3141 .
Unit tests have been added to cover this scenario. This change also ensures that a return_code is always returned by the function, and updates some stale comments.

Signed-off-by: Kartik Ganesh <[email protected]>
kartg added a commit to opensearch-project/opensearch-migrations that referenced this issue Jan 23, 2024
…M) (#478)

The orchestrator now suppresses exit code 143 if it is returned by the migration monitor, since this is a result of a workaround for opensearch-project/data-prepper#3141 .
Unit tests have been added to cover this scenario. This change also ensures that a return_code is always returned by the function, and updates some stale comments.

Signed-off-by: Kartik Ganesh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants