Skip to main content
Announcements
Join us on Sept. 17 to hear how our new GenAI Assistant empowers data professionals: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
JosephBunda
Contributor II
Contributor II

Context Variable values are incorrect

I'm having a strange problem with Talend.

I've developed a relatively simple job that queries records from one system via a tRestClient component. The records are extracted, transformed, and transferred to a target Salesforce system.

I'm using context variables to determine the connection credentials for each system. The problem I'm encountering is that for the specific context variables being used in the tRestClient component, they are completely wrong.

For example: I've defined a Test environment. I've set the "Host" variable to "https://asdf.com/sourcesystem/". I can see in the run window's view of context variables that this is set correctly. When I run the job, I get a host not found error, unless I hardcode the host in the tRestClient component.

I dumped the values of the context, and to my surprise the "Host" variable is not set correctly. It contains the wrong value... say, "https://rtyu.com/sourcesystemB/". As many times as I've tried to correct, commit, update, you name it, this incorrect value persists.

Is there some trick or something I'm missing here? Why can't I get the correct value loaded into the tRestClient component?

I've also tried creating a new variable with a different name, but the context as a whole seems to be stuck in some old state.

(Edit)

An update: I've tried adding a new variable of a different name into the context, but it is not showing up when I dump it.

I've also tried creating an entirely separate job and dumping the context there, and it IS updated. The problem seems to be specific to the job I'm actively developing, it's "stuck" with a stale context that is both missing new variables and contains old values.

(Edit 2 - SOLVED)

Ah, I've figured it out. Apparently a job can erroneously cache old contexts. Updating values or adding new variables will not work in this state, and even in other subjobs this "stale context" can persist, causing massive problems.

What I did was deactivate the job that seemed to be most closely associated with this "stale context". As soon as I did so, the next time I ran the job all the proper context variables were reported, as well as their correct values. I then reactivated the affected job, and it was still correct.

TLDR; If you find your context variables out of whack with no clear explanation, try deactivating and reactivating nearby jobs and subjobs. It's the equivalent of kicking a machine to make it go, but hey. If it saves YOU, the reader, a few hours of mystery and frustration, then give it a try.

Labels (1)
4 Replies
Shicong_Hong
Support
Support

Hello

Glad to see you find a workaround to resolve the issue, if you can reproduce the issue again, please report a jira issue to R&D team for further investigation. 

Regards

Shicong

wanyingzhao
Contributor
Contributor

Hello @Shicong_Hong @JosephBunda , 

 

Did you find antoher solution to cancel this "stale context"? it is not very convenient to each time active and inactive the component to renew the correct context variable.

 

thank you in advance 

JosephBunda
Contributor II
Contributor II
Author

Hi @wanyingzhao ,

I may have found another possible solution. No guarantees.

Recently I had a production job which runs four subtasks, all against the same two systems but for different segments of data.

Three out of four of the subtasks were erroring out. Only the first subtask was working, and all three of the subsequent tasks were failing authentication with the source system. I checked several times, but could not figure out why authentication was working with just the first task, since the same context was being supplied to all four, and all in the same exact environment to boot. It seemed like the exact same problem I've encountered before.

What fixed it THIS time was printing off the context variables at the beginning of the job. I have a specific subjob that dumps the context to the log so I can verify that the correct values are being used (Talend seems to report the wrong environmental context with jobs. I've seen it say the environment was "Test" in a production job, but the context reported production values, so I don't trust it). 

Anyway, when I started dumping the context to the log, all four jobs started authenticating again without any other changes. This is bizarre, to say the least.

My take? There's a caching problem in Talend's platform.

@Shicong_Hong ,FYI

wanyingzhao
Contributor
Contributor

Hi @JosephBunda , 

 Thank you for your response, i used tjava to print de context varialbe at the beginning of the job, while i see the 'old value' of my context varialbe in log and the real context value that the job run with is also the 'old' one, without inactive my tRestclient component, i still cant renew the context variable as i want. How did you do to print the value?

 

thanks in advance.

Best regards

wanying