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

Facing a synchronization issue using the remote library with pabot #53

Open
bioneyez opened this issue Nov 4, 2020 · 1 comment
Open

Comments

@bioneyez
Copy link

bioneyez commented Nov 4, 2020

Problem:

I'm trying to use the old version of this library with pabot in order to execute multiple threads at once.

      <dependency>
           <groupId>com.github.ombre42</groupId>
           <artifactId>jrobotremoteserver</artifactId>
           <version>3.0</version>
       </dependency>

My first attempt to synchronize the library was to synchronize the whole keyword at first, but I'm still facing an issue that for some reason the 1st and 2nd thread that arrives interferes with each others return value. And always the 1st and the 2nd.

This is the method I'm calling. I also added some logging in order to find some thread interference ( multiple START print before an END) but thats not happening. Also right before the return statement the LOGGER writes the correct value.

Java code:

@RobotKeyword("Creates an application with the given arguments. \n\n" +
            "Example:\n" +
            "libOpenAccountDict | POSPF | 3 | ${applicationDataDictionary}")
    @ArgumentNames({"variablePrefix", "quantity", "applicationData"})
    synchronized public List<String> libOpenAccount(String variablePrefix, Integer quantity, Map<String, String> applicationData) throws Throwable{
        LOGGER.info("START libOpenAccount");
        OpenAccountParameter param = createOpenAccountParameterWithAppData(applicationData);
       ...
        this.openAccount.processWithErrorHandling(param, getStepResults(), this.getVariableStorage(), true);
        LOGGER.info("END libOpenAccount" + param.getOpenedAccounts());
        return param.getOpenedAccounts();
    }


    synchronized private OpenAccountParameter createOpenAccountParameterWithAppData(Map<String, String> applicationData) {
        OpenAccountParameter param = new OpenAccountParameter();

        param.setApplicationType(ApplicationType.valueOf(applicationData.get(APPLICATION_TYPE)));
       ....

        return param;
    }

Log file:

2020-10-31 17:14:27,914 INFO  [http-thread-pool-8080(3)      ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:35,282 INFO  [http-thread-pool-8080(3)      ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004100]
2020-10-31 17:14:35,319 INFO  [http-thread-pool-8080(3)      ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004100]
2020-10-31 17:14:35,319 INFO  [http-thread-pool-8080(3)      ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004100]
2020-10-31 17:14:35,319 INFO  [http-thread-pool-8080(190)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:41,051 INFO  [http-thread-pool-8080(190)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004111]
2020-10-31 17:14:41,054 INFO  [http-thread-pool-8080(190)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004111]
2020-10-31 17:14:41,054 INFO  [http-thread-pool-8080(190)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004111]
2020-10-31 17:14:41,055 INFO  [http-thread-pool-8080(187)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:46,589 INFO  [http-thread-pool-8080(187)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004122]
2020-10-31 17:14:46,594 INFO  [http-thread-pool-8080(187)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004122]
2020-10-31 17:14:46,594 INFO  [http-thread-pool-8080(187)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004122]
2020-10-31 17:14:46,594 INFO  [http-thread-pool-8080(4)      ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:50,365 INFO  [http-thread-pool-8080(4)      ] c.s.l.s.a.c.OpenAccountAction: Applications created[L130000004136]
2020-10-31 17:14:50,369 INFO  [http-thread-pool-8080(4)      ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L130000004136]
2020-10-31 17:14:50,369 INFO  [http-thread-pool-8080(4)      ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L130000004136]
2020-10-31 17:14:50,369 INFO  [http-thread-pool-8080(191)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:55,875 INFO  [http-thread-pool-8080(191)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004144]
2020-10-31 17:14:55,879 INFO  [http-thread-pool-8080(191)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004144]
2020-10-31 17:14:55,879 INFO  [http-thread-pool-8080(191)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004144]
2020-10-31 17:14:55,879 INFO  [http-thread-pool-8080(195)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:14:59,198 INFO  [http-thread-pool-8080(195)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L130000004158]
2020-10-31 17:14:59,204 INFO  [http-thread-pool-8080(195)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L130000004158]
2020-10-31 17:14:59,204 INFO  [http-thread-pool-8080(195)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L130000004158]
2020-10-31 17:14:59,204 INFO  [http-thread-pool-8080(185)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:04,070 INFO  [http-thread-pool-8080(185)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004166]
2020-10-31 17:15:04,075 INFO  [http-thread-pool-8080(185)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004166]
2020-10-31 17:15:04,075 INFO  [http-thread-pool-8080(185)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004166]
2020-10-31 17:15:04,075 INFO  [http-thread-pool-8080(192)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:07,342 INFO  [http-thread-pool-8080(192)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L130000004171]
2020-10-31 17:15:07,346 INFO  [http-thread-pool-8080(192)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L130000004171]
2020-10-31 17:15:07,346 INFO  [http-thread-pool-8080(192)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L130000004171]
2020-10-31 17:15:07,346 INFO  [http-thread-pool-8080(184)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:12,741 INFO  [http-thread-pool-8080(184)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004188]
2020-10-31 17:15:12,745 INFO  [http-thread-pool-8080(184)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004188]
2020-10-31 17:15:12,745 INFO  [http-thread-pool-8080(184)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004188]
2020-10-31 17:15:12,745 INFO  [http-thread-pool-8080(2)      ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:17,593 INFO  [http-thread-pool-8080(2)      ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004199]
2020-10-31 17:15:17,598 INFO  [http-thread-pool-8080(2)      ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004199]
2020-10-31 17:15:17,598 INFO  [http-thread-pool-8080(2)      ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004199]
2020-10-31 17:15:17,598 INFO  [http-thread-pool-8080(188)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:22,405 INFO  [http-thread-pool-8080(188)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004208]
2020-10-31 17:15:22,409 INFO  [http-thread-pool-8080(188)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004208]
2020-10-31 17:15:22,409 INFO  [http-thread-pool-8080(188)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004208]
2020-10-31 17:15:22,409 INFO  [http-thread-pool-8080(5)      ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:27,568 INFO  [http-thread-pool-8080(5)      ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004219]
2020-10-31 17:15:27,572 INFO  [http-thread-pool-8080(5)      ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004219]
2020-10-31 17:15:27,572 INFO  [http-thread-pool-8080(5)      ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004219]
2020-10-31 17:15:27,572 INFO  [http-thread-pool-8080(186)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:30,433 INFO  [http-thread-pool-8080(186)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L130000004222]
2020-10-31 17:15:30,436 INFO  [http-thread-pool-8080(186)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L130000004222]
2020-10-31 17:15:30,437 INFO  [http-thread-pool-8080(186)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L130000004222]
2020-10-31 17:15:30,437 INFO  [http-thread-pool-8080(1)      ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:35,344 INFO  [http-thread-pool-8080(1)      ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004230]
2020-10-31 17:15:35,348 INFO  [http-thread-pool-8080(1)      ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004230]
2020-10-31 17:15:35,348 INFO  [http-thread-pool-8080(1)      ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004230]
2020-10-31 17:15:35,348 INFO  [http-thread-pool-8080(194)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:40,325 INFO  [http-thread-pool-8080(194)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L329000004241]
2020-10-31 17:15:40,329 INFO  [http-thread-pool-8080(194)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L329000004241]
2020-10-31 17:15:40,330 INFO  [http-thread-pool-8080(194)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L329000004241]
2020-10-31 17:15:40,330 INFO  [http-thread-pool-8080(189)    ] c.s.l.t.r.ApplicationLibrary: START libOpenAccount
2020-10-31 17:15:43,689 INFO  [http-thread-pool-8080(189)    ] c.s.l.s.a.c.OpenAccountAction: Applications created[L130000004255]
2020-10-31 17:15:43,694 INFO  [http-thread-pool-8080(189)    ] c.s.l.s.a.c.OpenAccountAction: OPENED ACCOUNTS[L130000004255]
2020-10-31 17:15:43,694 INFO  [http-thread-pool-8080(189)    ] c.s.l.t.r.ApplicationLibrary: END libOpenAccount[L130000004255]

Robot log.html

  • In the two test cases which interferes with each other:

Test 1

bad_result_1

Test 2

bad_result_2

  • Instead of something like this:

good_result

@Hi-Fi
Copy link
Collaborator

Hi-Fi commented Mar 24, 2022

@bioneyez is this happening also with latest version? If yes, do you have repo that can be used to reproduce the issue easy way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants