<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Is tSalesforceOutput thread safe? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2319330#M89588</link>
    <description>&lt;P&gt;I am trying to streamline the loading of ContentVersion records (attachments) to salesforce by using a tFlowtoIterate with enable parallel execution to parallelize a call to a child job. I have also tried this without a child job and got the same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ContentVersions have to be loaded serially into salesforce, they can't be grouped in to batches greater than 1 record owing to various restrictions in salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am trying to work around this by setting up many threads all running a single record into salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To start with the job runs very fast with multiple threads executing to load into salesforce. However after n records the tSalesforceOutput component fails with the following string index error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This error does not occur if I set the tRunJob to use separate processes for each execution however the overhead of setting up a new process for each iteration slows the process down so much it is no faster than the serial method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I suspect that something in tSalesforceOutput is not thread safe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone seen this behaviour before or know if my hunch is correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;Exception in component tRunJob_1 (PutAttachmentParent)&lt;BR /&gt;java.lang.RuntimeException: Child job running failed.&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: -8&lt;BR /&gt;at ihs.putattachmentparent_0_3.PutAttachmentParent$1tRunJob_1Thread.run(PutAttachmentParent.java:4970)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----Here is the exception log if I don't use a child job&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;18:30:37,049 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:26,508 INFO [SalesforceWriter] Prepare to insert record 1.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted record 1 successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has rejected 0 records.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Failed to insert record 1.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has rejected 1 records.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Done.&lt;BR /&gt;Exception in component tSalesforceOutput_1 (PutAttachmentParallel)&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: 13&lt;BR /&gt;at java.lang.String.substring(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.subformat(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.format(Unknown Source)&lt;BR /&gt;at java.text.Format.format(Unknown Source)&lt;BR /&gt;at org.talend.daikon.i18n.I18nMessages.getFormattedMessage(I18nMessages.java:63)&lt;BR /&gt;at org.talend.daikon.i18n.ClassBasedI18nMessages.getMessage(ClassBasedI18nMessages.java:76)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.getPastForm(SalesforceWriter.java:738)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.handleSuccess(SalesforceWriter.java:511)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.doInsert(SalesforceWriter.java:351)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.insert(SalesforceWriter.java:328)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.write(SalesforceWriter.java:185)&lt;BR /&gt;at ihs.putattachmentparallel_0_3.PutAttachmentParallel$1tDBInput_2Thread.run(PutAttachmentParallel.java:8802)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 05:47:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T05:47:13Z</dc:date>
    <item>
      <title>Is tSalesforceOutput thread safe?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2319330#M89588</link>
      <description>&lt;P&gt;I am trying to streamline the loading of ContentVersion records (attachments) to salesforce by using a tFlowtoIterate with enable parallel execution to parallelize a call to a child job. I have also tried this without a child job and got the same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ContentVersions have to be loaded serially into salesforce, they can't be grouped in to batches greater than 1 record owing to various restrictions in salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am trying to work around this by setting up many threads all running a single record into salesforce.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To start with the job runs very fast with multiple threads executing to load into salesforce. However after n records the tSalesforceOutput component fails with the following string index error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This error does not occur if I set the tRunJob to use separate processes for each execution however the overhead of setting up a new process for each iteration slows the process down so much it is no faster than the serial method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I suspect that something in tSalesforceOutput is not thread safe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone seen this behaviour before or know if my hunch is correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;Exception in component tRunJob_1 (PutAttachmentParent)&lt;BR /&gt;java.lang.RuntimeException: Child job running failed.&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: -8&lt;BR /&gt;at ihs.putattachmentparent_0_3.PutAttachmentParent$1tRunJob_1Thread.run(PutAttachmentParent.java:4970)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----Here is the exception log if I don't use a child job&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;18:30:37,049 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:26,508 INFO [SalesforceWriter] Prepare to insert record 1.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted record 1 successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Has rejected 0 records.&lt;BR /&gt;18:31:27,250 INFO [SalesforceWriter] Done.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Failed to insert record 1.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has inserted 1 records successfully.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Has rejected 1 records.&lt;BR /&gt;18:31:27,828 INFO [SalesforceWriter] Done.&lt;BR /&gt;Exception in component tSalesforceOutput_1 (PutAttachmentParallel)&lt;BR /&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: 13&lt;BR /&gt;at java.lang.String.substring(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.subformat(Unknown Source)&lt;BR /&gt;at java.text.MessageFormat.format(Unknown Source)&lt;BR /&gt;at java.text.Format.format(Unknown Source)&lt;BR /&gt;at org.talend.daikon.i18n.I18nMessages.getFormattedMessage(I18nMessages.java:63)&lt;BR /&gt;at org.talend.daikon.i18n.ClassBasedI18nMessages.getMessage(ClassBasedI18nMessages.java:76)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.getPastForm(SalesforceWriter.java:738)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.handleSuccess(SalesforceWriter.java:511)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.doInsert(SalesforceWriter.java:351)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.insert(SalesforceWriter.java:328)&lt;BR /&gt;at org.talend.components.salesforce.runtime.SalesforceWriter.write(SalesforceWriter.java:185)&lt;BR /&gt;at ihs.putattachmentparallel_0_3.PutAttachmentParallel$1tDBInput_2Thread.run(PutAttachmentParallel.java:8802)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runIt(TalendThreadPool.java:159)&lt;BR /&gt;at routines.system.ThreadPoolWorker.runWork(TalendThreadPool.java:150)&lt;BR /&gt;at routines.system.ThreadPoolWorker.access$0(TalendThreadPool.java:145)&lt;BR /&gt;at routines.system.ThreadPoolWorker$1.run(TalendThreadPool.java:122)&lt;BR /&gt;at java.lang.Thread.run(Unknown Source)&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:47:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2319330#M89588</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T05:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is tSalesforceOutput thread safe?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2319331#M89589</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;Please have a look at this topic:&lt;A title="https://community.talend.com/t5/Design-and-Development/Is-tSalesforceOutput-thread-safe/m-p/161539#M98508" href="https://community.qlik.com/s/feed/0D73p000004kZqICAU#M98508" target="_self"&gt;https://community.talend.com/t5/Design-and-Development/Is-tSalesforceOutput-thread-safe/m-p/161539#M98508&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;Best regards&lt;/P&gt; 
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 09:58:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-tSalesforceOutput-thread-safe/m-p/2319331#M89589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-21T09:58:56Z</dc:date>
    </item>
  </channel>
</rss>

