You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by "DmitriiMukhin (via GitHub)" <gi...@apache.org> on 2023/02/13 13:12:18 UTC

[I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread (plc4x)

DmitriiMukhin opened a new issue, #801:
URL: https://github.com/apache/plc4x/issues/801

   ### What happened?
   
   When s7 driver can't establish connection with controller it creates threads that being falling into park state TIMED_WAITING. While application keep trying to connect via PlcDriverManger.getConnection(url) such threads count continuously growing. In the end we have java.lang.OutOfMemoryError: unable to create native thread.
   
   We are using s7 driver to communicate with different controllers from single app.
   
   Screenshots just to demonstrate an issue. Driver creates thousands of such threads.
   
   ![Screenshot from 2023-02-13 16-06-18](https://user-images.githubusercontent.com/88187872/218466285-04277e1c-c9cb-490a-aaeb-227bcc9ee71f.png)
   ![Screenshot from 2023-02-13 16-06-30](https://user-images.githubusercontent.com/88187872/218466306-a9a3a71b-1c5e-4c7a-bfa3-e66b761faade.png)
   ![Screenshot from 2023-02-13 16-06-39](https://user-images.githubusercontent.com/88187872/218466322-12cda2c2-28a2-478d-b282-fb44079787d9.png)
   ![Screenshot from 2023-02-13 16-10-05](https://user-images.githubusercontent.com/88187872/218467095-a7f7e4a5-c
   ![Screenshot from 2023-02-13 16-10-44](https://user-images.githubusercontent.com/88187872/218467111-0bcf2e24-7b3c-47c1-aa40-77673803595d.png)
   d5d-4777-8305-2b8dcaa51a98.png)
   
   
   ### Version
   
   v0.10.0
   
   ### Programming Languages
   
   - [X] plc4j
   - [ ] plc4go
   - [ ] plc4c
   - [ ] plc4net
   
   ### Protocols
   
   - [ ] AB-Ethernet
   - [ ] ADS /AMS
   - [ ] BACnet/IP
   - [ ] CANopen
   - [ ] DeltaV
   - [ ] DF1
   - [ ] EtherNet/IP
   - [ ] Firmata
   - [ ] KNXnet/IP
   - [ ] Modbus
   - [ ] OPC-UA
   - [X] S7


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread (plc4x)

Posted by "heyoulin (via GitHub)" <gi...@apache.org>.
heyoulin commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1428254992

   Can you try my resp [https://github.com/spnettec/plc4x.git](url)? If no problem i will cretae a pull request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread

Posted by "DmitriiMukhin (via GitHub)" <gi...@apache.org>.
DmitriiMukhin commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1733167171

   > Is this issue still open or has it been fixed?
   
   It could be fixed with provided PR. Such fix was tested in our local company fork. No more issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread

Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1731339513

   Is this issue still open or has it been fixed?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread (plc4x)

Posted by "DmitriiMukhin (via GitHub)" <gi...@apache.org>.
DmitriiMukhin commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1428619604

   @heyoulin 
   Thank you - great job.
   I think this part of your solution helped me. 
   ```
                   pipeline.addLast(new ChannelInboundHandlerAdapter() {
                                        @Override
                                        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
                                                throws PlcConnectionException {
                                            logger.error("unknown error, close the connection", cause);
                                            close();
                                        }
                                    }
                   );
   ```
   I've tested for a while - at first glance it works. Abandoned(parked) threads are absent. Connection is establishing as it should in normal situation, I mean when controller is accessible. I'll continue testing.
   
   I'll be forced to fork 0.10.0 release to our company repo with such fix. As we don't know when new fixed release will be published.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread

Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1733217081

   Ok ... as I've merged that PR, I'll close this issue, right?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread (plc4x)

Posted by "DmitriiMukhin (via GitHub)" <gi...@apache.org>.
DmitriiMukhin commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1429580842

   > @heyoulin Thank you - great job. I think this part of your solution helped me.
   > 
   > ```
   >                 pipeline.addLast(new ChannelInboundHandlerAdapter() {
   >                                      @Override
   >                                      public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
   >                                              throws PlcConnectionException {
   >                                          logger.error("unknown error, close the connection", cause);
   >                                          close();
   >                                      }
   >                                  }
   >                 );
   > ```
   > 
   > I've tested for a while - at first glance it works. Abandoned(parked) threads are absent. Connection is establishing as it should in normal situation, I mean when controller is accessible. I'll continue testing.
   > 
   > I'll be forced to fork 0.10.0 release to our company repo with such fix. As we don't know when new fixed release will be published.
   
   I was wrong. As I see only this part needed to fix that issue.
   
   ```
                   if (!awaitSessionSetupComplete) {
                       setProtocol(
                               stackConfigurer.configurePipeline(
                                       configuration,
                                       pipeline,
                                       getAuthentication(),
                                       channelFactory.isPassive()
                               )
                       );
                   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread (plc4x)

Posted by "DmitriiMukhin (via GitHub)" <gi...@apache.org>.
DmitriiMukhin commented on issue #801:
URL: https://github.com/apache/plc4x/issues/801#issuecomment-1429595690

   > @heyoulin Thank you - great job. I think this part of your solution helped me.
   > 
   > ```
   >                 pipeline.addLast(new ChannelInboundHandlerAdapter() {
   >                                      @Override
   >                                      public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
   >                                              throws PlcConnectionException {
   >                                          logger.error("unknown error, close the connection", cause);
   >                                          close();
   >                                      }
   >                                  }
   >                 );
   > ```
   > 
   > I've tested for a while - at first glance it works. Abandoned(parked) threads are absent. Connection is establishing as it should in normal situation, I mean when controller is accessible. I'll continue testing.
   > 
   > I'll be forced to fork 0.10.0 release to our company repo with such fix. As we don't know when new fixed release will be published.
   
   I was wrong. All code changes are needed. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread

Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz closed issue #801: [Bug]: S7 driver - java.lang.OutOfMemoryError: unable to create native thread
URL: https://github.com/apache/plc4x/issues/801


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@plc4x.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org