Hi everyone, We're facing an issue while using Air...
# replication-troubleshooting
s
Hi everyone, We're facing an issue while using Airbyte OSS on K8s. In a nutshell, all of our sync jobs (running 12 / hour) come to a standstill and the Airbyte worker cannot spin up any more job pods. We get the following errors:
Copy code
2023-03-02 10:11:16 ERROR i.a.w.g.DefaultReplicationWorker(replicate):259 - Sync worker failed.
io.airbyte.workers.exception.WorkerException: java.io.IOException: kubectl cp failed with exit code 1

2023-03-01 10:10:50 WARNi.t.i.s.WorkflowExecuteRunnable(throwAndFailWorkflowExecution):134 - Workflow execution failure WorkflowId='sync_2465', RunId=9dbc128b-e826-4cf2-b86e-6daad66ea1e2, WorkflowType='SyncWorkflow'
io.temporal.failure.ActivityFailure: scheduledEventId=51, startedEventId=52, activityType='Normalize', activityId='6be893fc-04a9-301c-b7ff-e921b5e0e2c8', identity='1@data-airbyte-worker-7dfdfd79f7-tq9q5', retryState=RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED
.....
Log4j2Appender says: Completing future exceptionally...
2023-03-01 10:10:50 INFOi.a.w.t.TemporalAttemptExecution(lambda$getWorkerThread$5):198 - Completing future exceptionally...
io.airbyte.workers.exception.WorkerException: Normalization Failed.
.....
Log4j2Appender says: Normalization failed for job 2466.
2023-03-01 10:34:56 ERROR i.a.w.g.DefaultReplicationWorker(replicate):259 - Sync worker failed.
io.airbyte.workers.exception.WorkerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "io.airbyte.workers.process.KubePortManagerSingleton.take()" is null
Once we restart the worker pod - things return to normal. We face this issue 1-2 times per day at different times. Are there any related open issues or suggestions on how to tune configurations to avoid this? Related issues: β€’ This issue has been closed but we are experiencing the same issue: https://github.com/airbytehq/airbyte/issues/10748#issuecomment-1069139006 β€’ We have deployed the newest Airbyte version which includes the increased timeout fix mentioned here: https://github.com/airbytehq/airbyte/issues/22907 Airbyte version:
0.41.0
I can confirm that the worker has sufficient resources (cpu/memory/disk) so I do not believe this is the issue.
πŸ‘€ 1
πŸ‘ 5
βž• 1
m
What version of Helm Chart are you using Sean?
s
@Marcos Marx (Airbyte) We are using the latest chart version: 0.44.5 airbyte version: 0.41.0
After digging through the code, we have found that the issue lies within the Worker process. Within the KubePortManagerSingleton class specifically. We hit a point where the KubeProcessFactory never returns a port from the KubePortManagerSingleton take() method I believe the <https://github.com/airbytehq/airbyte-platform/blob/4271bb673251268ca47b7fe954340271931af722/airbyte-commons-worker/src/main/java/io/airbyte/workers/process/KubePortManagerSingleton.java#L35%7CBlockingQueue<Integer> workerPorts> variable does not provide sufficient ports to the KubePodProcess function causing an outage until we restart the workers. Do you know how the workerPorts are managed (Added/deleted)? We're in the process of scaling the number of Worker instances (2 -> 5). Are there any other scaling parameters relating to the above issue we should be concerned with? I can open an issue for this and I can help out with updates if needed?
m
@Davin Chia (Airbyte) would you mind giving your opinion here?
p
We are also impacted by this problem (20 workers with 1000+ connectors). Would gladly test any solution πŸ™‚
m
Pierre, you have only one worker pod?
p
No, I have 20 of them
d
Hi sorry I’m traveling now. Will take a closer look in a few hours. Are both of you using the container orchestrator?
p
For me yes
s
Yes, we are using the container orchestrator. FYI, Scaling out our worker replicas has reduced the frequency of this issue occurring but it is still occurring intermittently (Every couple of days).
It would be great if we could add more logging to this process. I've opened a PR here to add some debug logging to the KubePortManagerSingleton java class. I totally understand if this is not possible but just a suggestion to help us understand the issue a little better
I can open an issue on this if it is not already tracked (I want to be mindful of opening duplicate issues)
o
Hey @Sean Glynn did you make any progress on this? We see the same thing happen every 3-4 days (we don't have tons of connectors which could be why it happens less often for us).
s
Hey @Oliver Meyer Unfortunately no.. We are also hitting this issue every 3-4 days while running ~15 connectors on a 30 - 60 minute cadence. Restarting the worker deployment every 2 days or so seems to mitigate this issue for the time being.
Hopefully we can work towards a long term fix for this sooner rather than later
o
Yeah we set up a Slack reminder to restart the workers every 2 days but that's not a very nice solution
Did you get around to opening an issue?
s
I agree this is not a nice solution πŸ₯΄
I did not open an issue yet. I was waiting to hear back from the Airbyte team but I think I will just go ahead and open this shortly
πŸ‘ 1
o
Cool. I'll give it a πŸ‘
s
Issue opened here πŸ™‚
πŸ‘ 3
a
We’re also experiencing this issue and would like to +1 any efforts to fix thisπŸ˜… Looks like there is a PR for a fix! https://github.com/airbytehq/airbyte-platform/pull/217 Is there anyone from Airbyte that could take a look? @Marcos Marx (Airbyte) @Davin Chia (Airbyte)?
plus1 1
m
I dont know if this is related to same port issue but we are also getting same sync failure issue and it quite frequent, we are restarting airbyte workers once every 2-3 days. please find the issue as below,
Copy code
2023-04-12 03:35:20 - Additional Failure Information: Setting attempt to FAILED because the temporal workflow for this connection was restarted, and existing job state was cleaned.
2023-04-12 03:20:00 ERROR i.a.w.g.DefaultCheckConnectionWorker(run):100 - Unexpected error while checking connection: 
io.airbyte.workers.exception.WorkerException: null
	at io.airbyte.workers.process.KubeProcessFactory.create(KubeProcessFactory.java:138) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at io.airbyte.workers.process.AirbyteIntegrationLauncher.check(AirbyteIntegrationLauncher.java:84) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at io.airbyte.workers.general.DefaultCheckConnectionWorker.run(DefaultCheckConnectionWorker.java:63) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at io.airbyte.workers.general.DefaultCheckConnectionWorker.run(DefaultCheckConnectionWorker.java:37) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at java.lang.Thread.run(Thread.java:1589) [?:?]
Caused by: java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1681) ~[?:?]
	at java.util.concurrent.LinkedBlockingDeque.pollFirst(LinkedBlockingDeque.java:515) ~[?:?]
	at java.util.concurrent.LinkedBlockingDeque.poll(LinkedBlockingDeque.java:677) ~[?:?]
	at io.airbyte.workers.process.KubePortManagerSingleton.take(KubePortManagerSingleton.java:67) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	at io.airbyte.workers.process.KubeProcessFactory.create(KubeProcessFactory.java:102) ~[io.airbyte-airbyte-workers-0.39.42-alpha.jar:?]
	... 5 more
2023-04-12 03:20:00 INFO i.a.w.t.TemporalAttemptExecution(get):131 - Stopping cancellation check scheduling...
s
@Akash Patel what version of Airbyte are you using? We have not encountered this issue since upgrading to version:
0.42.1
@Manish Jaiswal the exception could be related but that does not tell us the real issue. Maybe if you scroll up through the logs it may give you more information?
a
Great @Sean Glynn! Didn’t catch it from reading anywhere if upgrade solved it. we’re running 0.42.0. We’ll try to upgrade.
s
Don't quote me on this. I'm not saying it has solved it I'm just saying we have not encountered this issue since upgrading
0.41.0
->
0.42.1
πŸ™‚
πŸ‘ 1
m
@Sean Glynn yes true, after debuging i can it seems like related to port issue because on older cluster (0.33.5) there only 1 port is running but on new cluster(0.39.42-alpha) more 50% ports are getting use even currently there was no sync is ruuning at a moment.
Will try to explore new version and find more about root cause of this issue ! we are running more than 4k syncs per day.
s
Wow that's a lot of daily syncs. Another suggestion if the version upgrade does not work which may help (Assuming you're running Airbyte via K8s): β€’ Look for any long-running job pods at the K8s level:
Copy code
k get pods -n data-airbyte -l airbyte=job-pod
β€’ If there are any stale job pods that exist greater than the TTL expected => Delete the pod β—¦ FYI: this is just a theory that some unexpected stale pods are hogging the ports
m
@Sean Glynn yes bro , we are using Airbyte via K8s. Thanks for help, will surely try this aspect of debugging as well.
πŸ‘Œ 1
o
we have not encountered this issue since upgrading
0.41.0
->
0.42.1
That's good news, I'll upgrade our deployment in the next few days and see if that helps in our case. Thanks for the tip
πŸ‘ 2
🀞 1
m
@Oliver Meyer have you tried
0.42.1
?, we are also planing to upgrade.
a
Just wanted to share that upgrading to 0.42.1 didn’t work and we tried upgrading to 0.44.0 as well πŸ˜•. Crashes happening approx every 22-27 hrs.
πŸ˜• 2
s
Try increasing your worker replica count and see if you get the same results @Akash Patel
o
The issue has supposedly been fixed by this commit released in v0.45.20 of the Helm chart. We just upgraded and will know whether the fix worked in a few days.
πŸ™ 1
s
We have just upgraded this morning also 🀞
o
We just started getting the same errors again
Copy code
2023-05-18 09:44:57 ERROR i.a.w.g.DefaultReplicationWorker(replicate):279 - Sync worker failed.
io.airbyte.workers.exception.WorkerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "io.airbyte.workers.process.KubePortManagerSingleton.take()" is null
It took longer than before for them to appear so it looks like the commit above helped, but didn't fix the problem completely 😞
😒 1
m
@Oliver Meyer, the way we are dealing with is increase the numbers of ports and restart workers via scheduling it. (we are still using older airbyte version 0.39.42)
o
We have a Slack reminder to restart the workers πŸ˜‚
πŸ˜‚ 1
Is anyone else still getting this or is it just us?
s
We have not experienced this error in over 3 weeks
πŸ‘‰ πŸͺ΅
o
That's so weird, we're still getting them every 2-3 days. @Sean Glynn would you mind confirming which versions of the Helm chart and Airbyte you're running?
s
AB helm charts version:
0.45.22
AB app version:
0.44.5
Did you try scaling out the worker replicas?
o
Thanks! Yeah we already have 8 worker replicas running. We could scale further but that would be a crazy number of workers for our workloads
c
We are on v0.50.9, but we are still facing the same issue. Was the root cause for this ever found ?
c
We are on
0.50.33
and experiencing this issue
βž• 1
c
Welcome to the club πŸ˜› No one wants to solve this one
🀣 4
d
Do people know if they have the container orchestrator turned on? One way to know is to see if there is an additional orchestrator pod during syncs
a
No, we do not have container orchestrator pod we only have 3 pods for sync normalization/source/destination pod. Also we are running on K8 cluster. what is the use of this container orchestrator pod ?
d
Bump
j
Bump
d
Hello! This will be deprecated when Docker is deprecated. Moving to Kubernetes should automatically solve this issue.
v
I am facing the same issue in Kubernetes and I do have orchestrator pods as well and the only solution is to keep restarting the workers at regular intervals Sharing this cronjob I use to restart the worker pods
Copy code
apiVersion: batch/v1
kind: CronJob
metadata:
  name: airbyte-worker-restart-cron
  namespace:  airbyte
spec:
  schedule: CRON_TZ=Asia/Kolkata 30 11 * * *
  concurrencyPolicy: "Replace"
  startingDeadlineSeconds: 200
  suspend: false
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: scaler-sa
          containers:
            - name:  airbyte-worker-restart-cron
              image: bitnami/kubectl:latest
              imagePullPolicy: IfNotPresent
              command:
                - /bin/sh
                - -c
                - |
                  echo "[+] Checking running orchestrator pods"
                  while [ $(kubectl get pods -n airbyte | grep -E 'Running|Pending|Init' | awk '{print $1}' | grep orchestrator | wc -l) -gt 0 ]; do
                    echo "[~] Waiting for orchestrator pods to complete"; sleep 5;
                  done
                  echo "[+] Restarting workers"
                  kubectl scale deploy airbyte-gipl-worker -n airbyte --replicas=0
                  sleep 1
                  kubectl scale deploy airbyte-gipl-worker -n airbyte --replicas=2
          restartPolicy: OnFailure
d
This should be solved with our new Workloads system. Please migrate and let me know if you still see this.