Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/1646
  
    @markap14 Would you review this fix since you originally worked on 
NIFI-3636.
    I've reproduced the issue with following test method which sends lots of 
S2S client requests concurrently against a NiFi cluster. The issue was 
reproducible before this patch and confirmed it's addressed by this patch:
    
    ```java
        @Test
        public void test() throws Exception {
            final ExecutorService executors = Executors.newFixedThreadPool(100);
            final AtomicInteger processed = new AtomicInteger();
            final AtomicInteger error = new AtomicInteger();
            for (int i = 0; i < 1000; i++) {
                executors.submit(() -> {
                    try (final SiteToSiteClient client = new 
SiteToSiteClient.Builder()
                            .transportProtocol(SiteToSiteTransportProtocol.HTTP)
                            .url("http://localhost:9011/nifi/";)
                            .portName("input")
                            .build()) {
    
                        final Transaction transaction = 
client.createTransaction(TransferDirection.SEND);
                        transaction.send("test".getBytes(), new HashMap<>());
                        transaction.confirm();
                        transaction.complete();
                        processed.incrementAndGet();
    
                    } catch (Exception e) {
                        logger.error("ERR!", e);
                        error.incrementAndGet();
                    }
                });
            }
            executors.shutdown();
            executors.awaitTermination(1, TimeUnit.DAYS);
            logger.warn("processed={}, err={}", new Object[]{processed.get(), 
error.get()});
        }
    ```
    
    On Mac OS X Sierra, I had to increase file descriptor limit to make above 
test works by creating limit.maxfiles.plist and limit.maxproc.plist as 
described in these web pages:
    - https://www.chrissearle.org/2016/10/01/too-many-open-files-on-osx-macos/
    - https://superuser.com/questions/830149/os-x-yosemite-too-many-files-open
    
    I hope the fix still preserve the performance gain in clustered environment 
that have been added by NIFI-3636. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to