问:
Microsoft Graph API working Locally, but not working on Server using Microsoft SDK
** I am trying to upload file in Sharepoint online using Mocrosoft SDK. I am able to upload from my local machine. But not able to upload from Linux server. getting below exception.
Please let me know if anyone knows root cause.**

`

```<code>com.microsoft.graph.core.ClientException: Error executing the request
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:410)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:202)
    at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:335)
    at com.microsoft.graph.requests.DriveItemCreateUploadSessionRequest.post(DriveItemCreateUploadSessionRequest.java:55)
    at com.deere.moci.pricing.query.SharepointOnlineController.retrieveLock(SharepointOnlineController.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.pricing.filter.LoggerFilter.logPayload(LoggerFilter.java:59)
    at com.deere.moci.pricing.filter.LoggerFilter.doFilter(LoggerFilter.java:47)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.security.config.MDCFilter.doFilter(MDCFilter.java:23)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.security.config.CorsFilterForHandle.doFilterInternal(CorsFilterForHandle.java:43)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.ForwardedHeaderFilter.doFilterInternal(ForwardedHeaderFilter.java:153)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:196)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:366)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:639)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:847)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1680)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:750)
Caused by: java.io.IOException: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:67)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at com.microsoft.graph.httpcore.TelemetryHandler.intercept(TelemetryHandler.java:69)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:407)
    ... 129 more
Caused by: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:55)
    ... 135 more
Caused by: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:53)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.executeRequest(AadInstanceDiscoveryProvider.java:245)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.sendInstanceDiscoveryRequest(AadInstanceDiscoveryProvider.java:200)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.doInstanceDiscoveryAndCache(AadInstanceDiscoveryProvider.java:298)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.getMetadataEntry(AadInstanceDiscoveryProvider.java:63)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.getAuthorityWithPrefNetworkHost(AuthenticationResultSupplier.java:41)
    at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:59)
    at com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.acquireTokenByClientCredential(AcquireTokenByClientCredentialSupplier.java:86)
    at com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.execute(AcquireTokenByClientCredentialSupplier.java:49)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:71)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:20)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at reactor.core.Exceptions.propagate(Exceptions.java:408)
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
    at reactor.core.publisher.Mono.block(Mono.java:1710)
    at com.azure.identity.implementation.HttpPipelineAdapter.send(HttpPipelineAdapter.java:85)
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequestWithRetries(HttpHelper.java:96)
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:49)
    ... 16 more
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
        ... 20 more
Caused by: io.netty.channel.StacklessClosedChannelException
    at io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(ChannelPromise)(Unknown Source)
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more
</code>```

`

I am able to upload using rest template in spring boot. but there are some issues while updating metadata. so i am trying to use microsoft SDk to upload and update metadata. everything is working locally using SDK. but not working on server.

Body:
** I am trying to upload file in Sharepoint online using Mocrosoft SDK. I am able to upload from my local machine. But not able to upload from Linux server. getting below exception.
Please let me know if anyone knows root cause.**

`

com.microsoft.graph.core.ClientException: Error executing the request
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:410)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
    at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:202)
    at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:335)
    at com.microsoft.graph.requests.DriveItemCreateUploadSessionRequest.post(DriveItemCreateUploadSessionRequest.java:55)
    at com.deere.moci.pricing.query.SharepointOnlineController.retrieveLock(SharepointOnlineController.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.pricing.filter.LoggerFilter.logPayload(LoggerFilter.java:59)
    at com.deere.moci.pricing.filter.LoggerFilter.doFilter(LoggerFilter.java:47)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.security.config.MDCFilter.doFilter(MDCFilter.java:23)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.deere.moci.security.config.CorsFilterForHandle.doFilterInternal(CorsFilterForHandle.java:43)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.ForwardedHeaderFilter.doFilterInternal(ForwardedHeaderFilter.java:153)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:196)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:366)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:639)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:847)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1680)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:750)
Caused by: java.io.IOException: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:67)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at com.microsoft.graph.httpcore.TelemetryHandler.intercept(TelemetryHandler.java:69)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:407)
    ... 129 more
Caused by: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
    at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:55)
    ... 135 more
Caused by: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:53)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.executeRequest(AadInstanceDiscoveryProvider.java:245)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.sendInstanceDiscoveryRequest(AadInstanceDiscoveryProvider.java:200)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.doInstanceDiscoveryAndCache(AadInstanceDiscoveryProvider.java:298)
    at com.microsoft.aad.msal4j.AadInstanceDiscoveryProvider.getMetadataEntry(AadInstanceDiscoveryProvider.java:63)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.getAuthorityWithPrefNetworkHost(AuthenticationResultSupplier.java:41)
    at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:59)
    at com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.acquireTokenByClientCredential(AcquireTokenByClientCredentialSupplier.java:86)
    at com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.execute(AcquireTokenByClientCredentialSupplier.java:49)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:71)
    at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:20)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException
    at reactor.core.Exceptions.propagate(Exceptions.java:408)
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
    at reactor.core.publisher.Mono.block(Mono.java:1710)
    at com.azure.identity.implementation.HttpPipelineAdapter.send(HttpPipelineAdapter.java:85)
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequestWithRetries(HttpHelper.java:96)
    at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:49)
    ... 16 more
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
        ... 20 more
Caused by: io.netty.channel.StacklessClosedChannelException
    at io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(ChannelPromise)(Unknown Source)
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more
    Suppressed: io.netty.channel.StacklessClosedChannelException
        ... 1 more

`

I am able to upload using rest template in spring boot. but there are some issues while updating metadata. so i am trying to use microsoft SDk to upload and update metadata. everything is working locally using SDK. but not working on server.


来源: stackexchange

问:
Integrate a function using trapz with datetime - Calculate Energy with a current vector
i have a problem with my calculation tool. I have a vector of current values and a time vector in datetime format. Now i need to get the integral for overall Power consumption and im struggling.

I tried to integrate about the vector with trapz but the outcome isn't realistic for this vector. I tested different vectors and signal but same result.

My timevector wasn't used in this example.

```<code>%% Power Calculate

Energy = Ch1L1*230;                %P=U*I scale vector with 230V
EnergySum = trapz(Energy)/1000     %Output: Power in kW
</code>```

Does anyone of you know a solution?

I think i misunderstand the time in this outcome. Normally the integral should be the overall Power consumption for the time i logged the data.

ContentLicense: CC BY-SA 4.0

Body:
i have a problem with my calculation tool. I have a vector of current values and a time vector in datetime format. Now i need to get the integral for overall Power consumption and im struggling.

I tried to integrate about the vector with trapz but the outcome isn't realistic for this vector. I tested different vectors and signal but same result.

My timevector wasn't used in this example.

%% Power Calculate

Energy = Ch1L1*230;                %P=U*I scale vector with 230V
EnergySum = trapz(Energy)/1000     %Output: Power in kW

Does anyone of you know a solution?

I think i misunderstand the time in this outcome. Normally the integral should be the overall Power consumption for the time i logged the data.


问:
How to consume data from AWS Kinesis fanout using nodejs @aws-sdk/client-kinesis lib v3?
How to consume data from AWS Kinesis fanout using nodejs @aws-sdk/client-kinesis v3 lib?
I registered a StreamConsumer and got a connection to a shard, but how do I consume data?

```<code>const client = new KinesisClient({ region });
//recover a consumer or create a new one
const { Consumers } = await client.send(new ListStreamConsumersCommand({ StreamARN }));

let consumer = Consumers.find((x) => x.ConsumerName == ConsumerName);
if (!consumer) {
  const { Consumer } = await client.send(new RegisterStreamConsumerCommand({ StreamARN, ConsumerName }));
  consumer = Consumer;
}

//subscribe to shard
const { EventStream } = await client.send(
  new SubscribeToShardCommand({
    ConsumerARN: consumer.ConsumerARN,
    ShardId: shardId,
    StartingPosition: { Type: 'TRIM_HORIZON' },
  }),
);
</code>```

Log of Consumers and EventStream looks like this:

```<code>Consumers: [
  {
    ConsumerARN: 'arn:aws:kinesis:ap-south-1:123123123:stream/test-stream/consumer/test-client:234234234',
    ConsumerCreationTimestamp: 2022-12-07T04:33:20.000Z,
    ConsumerName: 'test-client',
    ConsumerStatus: 'ACTIVE'
  }
]

EventStream:
{
  [Symbol(Symbol.asyncIterator)]: [AsyncGeneratorFunction: [Symbol.asyncIterator]]
}
</code>```

Body:
How to consume data from AWS Kinesis fanout using nodejs @aws-sdk/client-kinesis v3 lib?
I registered a StreamConsumer and got a connection to a shard, but how do I consume data?

const client = new KinesisClient({ region });
//recover a consumer or create a new one
const { Consumers } = await client.send(new ListStreamConsumersCommand({ StreamARN }));

let consumer = Consumers.find((x) => x.ConsumerName == ConsumerName);
if (!consumer) {
  const { Consumer } = await client.send(new RegisterStreamConsumerCommand({ StreamARN, ConsumerName }));
  consumer = Consumer;
}

//subscribe to shard
const { EventStream } = await client.send(
  new SubscribeToShardCommand({
    ConsumerARN: consumer.ConsumerARN,
    ShardId: shardId,
    StartingPosition: { Type: 'TRIM_HORIZON' },
  }),
);

Log of Consumers and EventStream looks like this:

Consumers: [
  {
    ConsumerARN: 'arn:aws:kinesis:ap-south-1:123123123:stream/test-stream/consumer/test-client:234234234',
    ConsumerCreationTimestamp: 2022-12-07T04:33:20.000Z,
    ConsumerName: 'test-client',
    ConsumerStatus: 'ACTIVE'
  }
]

EventStream:
{
  [Symbol(Symbol.asyncIterator)]: [AsyncGeneratorFunction: [Symbol.asyncIterator]]
}


问:
How to Keep a puppeteer instance in NextJS server
I'm using puppeteer in a NextJS server module and Only one instance of the puppeteer Browser (also with login information and some states from some puppeteer pages) is needed. I use globle.myBrowser to keep this instance.(because I don't need a database, so I can't store it in a database), if I don't keep it with globle.myBrowser, NextJs will load this module more than once, so I can't keep the state.

It's all good until when I modify this module, hot reload will not work, because global.myBrowser will still point to the old module and new module will not working.

My questions are:

Is there any other better way to keep this instance of puppeteer?

if using globle to track the instance, How can I detect hot reload? I using module.hot.accept but get: "accept is undefined.


问:
i am getting error at pushing data to a pgSQL server in Luigi even-thou if i run the python script it works completely fine
I was building a data pipeline that gets json data from a url and changes it into csv format than i clean the data a bit and then push data to a sql server
Everything works of except for last task i am getting this error
RuntimeError: Unfulfilled dependency at run time: dataclean__99914b932b

import requests
import luigi
from bs4 import BeautifulSoup
import json
import csv
import pandas as pd
import psycopg2

class scrapper(luigi.Task):
    """
    Get data from nycstationinfo.com
    """

    def output(self):
        return luigi.LocalTarget("nycbikedata.json")

    def run(self):
        headers = {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Methods': 'GET',
        'Access-Control-Allow-Headers': 'Content-Type',
        'Access-Control-Max-Age': '3600',
        'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'
        }

        url = "https://gbfs.citibikenyc.com/gbfs/en/station_information.json"
        req = requests.get(url, headers)
        soup = BeautifulSoup(req.content, 'html.parser')
        #get the whole dump of the webpage in pretified form
        data = soup.prettify()
        #removing back slashes due to wraping
        json_string = json.dumps(data)
        mod_json_strings = json.loads(json_string)
        #writing the formated data in a file
        with self.output().open('w') as outfile:
            outfile.write(mod_json_strings)
class converter(luigi.Task):
    def requires(self):
        return scrapper()

    def output(self):
            return luigi.LocalTarget("nycbikedata.csv")

    def run(self):

        #opening json file with data
        with self.input().open('r') as json_file:
            data = json.load(json_file)
        #all the data is in station object data.json file
        station = data['data']['stations']
        data_file = self.output().open('w')
        csv_writer = csv.writer(data_file)
        count = 0

        for x in station:
            if count == 0:
                # Writing headers of CSV file
                header = x.keys()
                csv_writer.writerow(header)
                count += 1

            # Writing data of CSV file
            csv_writer.writerow(x.values())

        data_file.close()

class dataclean(luigi.Task):
    def requires(self):
        return converter()
    def run(self):
        df = pd.read_csv(self.input().open('r'))
        x = df.drop(df.columns[6:], axis = 1 )
        x = x[:1001]
        x.to_csv('formated.csv', index=False)

class datapush(luigi.Task):
    def requires(self):
        return dataclean()
    def run(self):
        hostname = 'localhost'
        database = 'mydb2'
        username = 'bob'
        pwd      = 'admin'
        port_id  =  5432
        try:
            conn = psycopg2.connect(
                        host = hostname,
                        dbname = database,
                        user = username,
                        password = pwd,
                        port = port_id)

            cur = conn.cursor()

            create_script = '''CREATE TABLE IF NOT EXISTS nyc_station(
                                    name        varchar(240),
                                    lon         float,
                                    lat         float,
                                    region_id   int,
                                    rental_methods varchar(140),
                                    station_id  int); '''
            cur.execute(create_script)

            sql2 = '''COPY nyc_station(name,lon,lat,region_id,rental_methods,station_id)
                    FROM '/home/wassey/luigi-demo/formated.csv'
                    DELIMITER ','
                    CSV HEADER;'''

            cur.execute(sql2)
            conn.commit()
        except Exception as error:
            print('error')
        finally:
            if cur is not None:
                cur.close()
            if conn is not None:
                conn.close()

if __name__ == "__main__":
    luigi.run()
```

All the tasks work fine except for the datapush but i seprately run the script it works completly fine and pushes the data

Body:
I was building a data pipeline that gets json data from a url and changes it into csv format than i clean the data a bit and then push data to a sql server
Everything works of except for last task i am getting this error
RuntimeError: Unfulfilled dependency at run time: dataclean__99914b932b

import requests
import luigi
from bs4 import BeautifulSoup
import json
import csv
import pandas as pd
import psycopg2

class scrapper(luigi.Task):
    """
    Get data from nycstationinfo.com
    """

    def output(self):
        return luigi.LocalTarget("nycbikedata.json")

    def run(self):
        headers = {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Methods': 'GET',
        'Access-Control-Allow-Headers': 'Content-Type',
        'Access-Control-Max-Age': '3600',
        'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'
        }

        url = "https://gbfs.citibikenyc.com/gbfs/en/station_information.json"
        req = requests.get(url, headers)
        soup = BeautifulSoup(req.content, 'html.parser')
        #get the whole dump of the webpage in pretified form
        data = soup.prettify()
        #removing back slashes due to wraping
        json_string = json.dumps(data)
        mod_json_strings = json.loads(json_string)
        #writing the formated data in a file
        with self.output().open('w') as outfile:
            outfile.write(mod_json_strings)
class converter(luigi.Task):
    def requires(self):
        return scrapper()

    def output(self):
            return luigi.LocalTarget("nycbikedata.csv")

    def run(self):

        #opening json file with data
        with self.input().open('r') as json_file:
            data = json.load(json_file)
        #all the data is in station object data.json file
        station = data['data']['stations']
        data_file = self.output().open('w')
        csv_writer = csv.writer(data_file)
        count = 0

        for x in station:
            if count == 0:
                # Writing headers of CSV file
                header = x.keys()
                csv_writer.writerow(header)
                count += 1

            # Writing data of CSV file
            csv_writer.writerow(x.values())

        data_file.close()

class dataclean(luigi.Task):
    def requires(self):
        return converter()
    def run(self):
        df = pd.read_csv(self.input().open('r'))
        x = df.drop(df.columns[6:], axis = 1 )
        x = x[:1001]
        x.to_csv('formated.csv', index=False)

class datapush(luigi.Task):
    def requires(self):
        return dataclean()
    def run(self):
        hostname = 'localhost'
        database = 'mydb2'
        username = 'bob'
        pwd      = 'admin'
        port_id  =  5432
        try:
            conn = psycopg2.connect(
                        host = hostname,
                        dbname = database,
                        user = username,
                        password = pwd,
                        port = port_id)

            cur = conn.cursor()

            create_script = '''CREATE TABLE IF NOT EXISTS nyc_station(
                                    name        varchar(240),
                                    lon         float,
                                    lat         float,
                                    region_id   int,
                                    rental_methods varchar(140),
                                    station_id  int); '''
            cur.execute(create_script)

            sql2 = '''COPY nyc_station(name,lon,lat,region_id,rental_methods,station_id)
                    FROM '/home/wassey/luigi-demo/formated.csv'
                    DELIMITER ','
                    CSV HEADER;'''

            cur.execute(sql2)
            conn.commit()
        except Exception as error:
            print('error')
        finally:
            if cur is not None:
                cur.close()
            if conn is not None:
                conn.close()

if __name__ == "__main__":
    luigi.run()

All the tasks work fine except for the datapush but i seprately run the script it works completly fine and pushes the data


问:
Generating A Trailing Stop Strategy in Pandas But Cannot Prevent Re-issue Signal
I am relatively new to Python & Pandas. I am trying to generate a trailing stop strategy where once the total p&l of the position reaches either ultimate stop loss level, or the trailing stop level, position will be reset to zero, and will REMAIN zero. I am able to reset the position to zero, however, once the p&l moves above trailing stop, position resets back to original level.

Please see the code snippets below. I am sure there is an easy solution, but I am not able to think of it. Appreciate any help, any clue to move forward.

```<code>df['price_prev'] = df['close'].shift(1)
df['delta_price'] = df['close'] - df['price_prev']
df['delta_tick'] = df['delta_price']/tick
df['position open'] = position_open #this is set to a specific amount e.g. 100 at start
df['position held'] = df['position open'] * buy_sell_signal() #the signal function gives a +1/-1 signal
df['p_l'] = df['delta_tick'] * df['position held']*tickvalue

df['total p&l'] = df['p_l'].cumsum()
df['trailing stop'] = df['total p&l'].cummax() + stop_loss
def change_position(x):
    if x['total p&l'] <= x['trailing stop']:
        x['position held'] = 0
    return x
df = df.apply(change_position,axis='columns')

</code>```

In row 235 df['position held'] resets to zero, because the df['total p&l'] went below df['trailing stop']. This is the EXPECTED behaviour. However, as df['p_l'] continues to evaluate, the df['position held'] reverts to previous level.

How can I prevent this? I would like it to remain zero.

Slice of dataframe:

Body:
I am relatively new to Python & Pandas. I am trying to generate a trailing stop strategy where once the total p&l of the position reaches either ultimate stop loss level, or the trailing stop level, position will be reset to zero, and will REMAIN zero. I am able to reset the position to zero, however, once the p&l moves above trailing stop, position resets back to original level.

Please see the code snippets below. I am sure there is an easy solution, but I am not able to think of it. Appreciate any help, any clue to move forward.

df['price_prev'] = df['close'].shift(1)
df['delta_price'] = df['close'] - df['price_prev']
df['delta_tick'] = df['delta_price']/tick
df['position open'] = position_open #this is set to a specific amount e.g. 100 at start
df['position held'] = df['position open'] * buy_sell_signal() #the signal function gives a +1/-1 signal
df['p_l'] = df['delta_tick'] * df['position held']*tickvalue

df['total p&l'] = df['p_l'].cumsum()
df['trailing stop'] = df['total p&l'].cummax() + stop_loss
def change_position(x):
    if x['total p&l'] <= x['trailing stop']:
        x['position held'] = 0
    return x
df = df.apply(change_position,axis='columns')

In row 235 df['position held'] resets to zero, because the df['total p&l'] went below df['trailing stop']. This is the EXPECTED behaviour. However, as df['p_l'] continues to evaluate, the df['position held'] reverts to previous level.

How can I prevent this? I would like it to remain zero.

Slice of dataframe:


问:
How to use yii2 joinWith aggregation (count, sum) query
I know use with query:

```<code>$customers = Customer::find()->with([
    'country',
    'orders' => function ($query) {
        $query->andWhere(['status' => Order::STATUS_ACTIVE]);
    },
])->all();
</code>```

But, When I use count in with query, The result didn't contains aggregation column, Like that:

```<code>$query = UserInviteRecord::find()
    ->alias('ui')
    ->with([
        'userInfo',
        'inviteOrder' => function ($query) {
            $query->select(['invite_user_id', 'count(id) as total_count']);
            $query->where(['status' => 1]);
            $query->groupBy('invite_user_id');
        }])
    ->where(['ui.type' => 0])
</code>```

Result only contains invite_user_id column.

replace select query:

$query->select(['invite_user_id', 'count(id) as total_count']);
```

Body:
I know use with query:

$customers = Customer::find()->with([
    'country',
    'orders' => function ($query) {
        $query->andWhere(['status' => Order::STATUS_ACTIVE]);
    },
])->all();

But, When I use count in with query, The result didn't contains aggregation column, Like that:

$query = UserInviteRecord::find()
    ->alias('ui')
    ->with([
        'userInfo',
        'inviteOrder' => function ($query) {
            $query->select(['invite_user_id', 'count(id) as total_count']);
            $query->where(['status' => 1]);
            $query->groupBy('invite_user_id');
        }])
    ->where(['ui.type' => 0])

Result only contains invite_user_id column.

replace select query:

$query->select(['invite_user_id', 'count(id) as total_count']);


问:
Kafka producer failing with SIGSEGV panic when closing the producer connection
Application Functionality :  Consumes messages from kafka queue and puts in buffered channel . From buffered channel, go function reads from that channel and do required message processing. if this message processing fails , it will publish back to the same kafka queue where message is consumed.

Problem : When i keep load to test this application, sometimes it is crashing with below error when producer is about to close / closing .

```<code>fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7f518cca5280 pc=0xbe690a]

runtime stack:
runtime.throw({0x1104c3f?, 0x1000?})
    /usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:802 +0x3a9

goroutine 7620665 [syscall]:
runtime.cgocall(0xb37af0, 0xc00426fb00)
    /usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc00426fad8 sp=0xc00426faa0 pc=0x46cc7c
github.com/confluentinc/confluent-kafka-go/kafka._Cfunc_do_produce(0x7f518cca4930, 0x7f518d6b8ea0, 0xffffffff, 0x2, 0x0, 0xc00bfd2000, 0xff5, 0x1, 0xc0053c85ec, 0x0, ...)
    _cgo_gotypes.go:773 +0x4f fp=0xc00426fb00 sp=0xc00426fad8 pc=0x94bcef
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).produce.func2(0x2?, 0x7f518d6b8ea0, 0x1346248?, 0x0, 0x1d3?, 0xc00426fc98, 0xc0226741c8?, 0x12946a80?, 0xc00426fcc8, 0x0, ...)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:263 +0x248 fp=0xc00426fbb8 sp=0xc00426fb00 pc=0x962de8
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).produce(0xc00d684580, 0xc00426fec0, 0x4cd07b?, 0xc0100970e0)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:263 +0x50e fp=0xc00426fd90 sp=0xc00426fbb8 pc=0x9628ce
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).Produce(...)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:285
server/queue.PublishToOutQ({0xc00bfd2000, 0xff5, 0xff5}, {0xc012a28d40, 0x8}, 0x0?, {0xc012908f60, 0x14}, {0x10e221f, 0x2}, ...)
    /tmp/test-server/queue/producer.go:256 +0x211 fp=0xc00426ff78 sp=0xc00426fd90 pc=0xb168b1
server/queue.SendMsg.func3()
    /tmp/test-server/queue/consumer.go:132 +0x57 fp=0xc00426ffe0 sp=0xc00426ff78 pc=0xb0aeb7
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00426ffe8 sp=0xc00426ffe0 pc=0x4d1d21
created by server/queue.SendMsg
    /tmp/test-server/queue/consumer.go:132 +0xb4f
</code>```

**Go Version : **

```<code>1.18
</code>```

**Confluent Kakfa Version : **

```<code>github.com/confluentinc/confluent-kafka-go v1.9.1
</code>```

kafka consumer configurations :

```<code>"consumer": {
    "queued.max.messages.kbytes.int": "1000000",
    "fetch.message.max.bytes.int": "1048576",
    "receive.message.max.bytes.int": "100000000",
    "max.partition.fetch.bytes.int": "1048576",
    "auto.offset.reset.string": "latest",
    "enable.auto.commit.boolean": "true",
    "auto.commit.interval.ms.int": "5000",
    "socket.keepalive.enable.boolean": "true",
    "metadata.max.age.ms.int": "900000",
    "session.timeout.ms.int": "30000",
    "heartbeat.interval.ms.int": "3000",
    "max.poll.interval.ms.int": "60000",
    "metadata.request.timeout.ms.int": "30000",
    "topic.metadata.refresh.interval.ms.int": "120000",
    "socket.timeout.ms.int": "10000",
    "fetch.wait.max.ms.int": "100",
    "statistics.interval.ms.int": "25000"
}
</code>```

Kafka producer configuration :

```<code>"producer": {
    "socket.keepalive.enable.boolean": "true",
    "metadata.max.age.ms.int": "900000",
    "metadata.request.timeout.ms.int": "30000",
    "topic.metadata.refresh.interval.ms.int": "120000",
    "retries.int": "1000000",
    "message.timeout.ms.int": "300000",
    "socket.timeout.ms.int": "10000",
    "max.in.flight.requests.per.connection.int": "5",
    "enable.idempotence.boolean": "true",
    "statistics.interval.ms.int": "25000"
}
</code>```

Can you please help me on fixing this issue. Thanks in advance.

Kafka publish to happen without errors but it is failing with segmentation violation error.

Body:
Application Functionality :  Consumes messages from kafka queue and puts in buffered channel . From buffered channel, go function reads from that channel and do required message processing. if this message processing fails , it will publish back to the same kafka queue where message is consumed.

Problem : When i keep load to test this application, sometimes it is crashing with below error when producer is about to close / closing .

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7f518cca5280 pc=0xbe690a]

runtime stack:
runtime.throw({0x1104c3f?, 0x1000?})
    /usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:802 +0x3a9

goroutine 7620665 [syscall]:
runtime.cgocall(0xb37af0, 0xc00426fb00)
    /usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc00426fad8 sp=0xc00426faa0 pc=0x46cc7c
github.com/confluentinc/confluent-kafka-go/kafka._Cfunc_do_produce(0x7f518cca4930, 0x7f518d6b8ea0, 0xffffffff, 0x2, 0x0, 0xc00bfd2000, 0xff5, 0x1, 0xc0053c85ec, 0x0, ...)
    _cgo_gotypes.go:773 +0x4f fp=0xc00426fb00 sp=0xc00426fad8 pc=0x94bcef
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).produce.func2(0x2?, 0x7f518d6b8ea0, 0x1346248?, 0x0, 0x1d3?, 0xc00426fc98, 0xc0226741c8?, 0x12946a80?, 0xc00426fcc8, 0x0, ...)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:263 +0x248 fp=0xc00426fbb8 sp=0xc00426fb00 pc=0x962de8
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).produce(0xc00d684580, 0xc00426fec0, 0x4cd07b?, 0xc0100970e0)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:263 +0x50e fp=0xc00426fd90 sp=0xc00426fbb8 pc=0x9628ce
github.com/confluentinc/confluent-kafka-go/kafka.(*Producer).Produce(...)
    /go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.1/kafka/producer.go:285
server/queue.PublishToOutQ({0xc00bfd2000, 0xff5, 0xff5}, {0xc012a28d40, 0x8}, 0x0?, {0xc012908f60, 0x14}, {0x10e221f, 0x2}, ...)
    /tmp/test-server/queue/producer.go:256 +0x211 fp=0xc00426ff78 sp=0xc00426fd90 pc=0xb168b1
server/queue.SendMsg.func3()
    /tmp/test-server/queue/consumer.go:132 +0x57 fp=0xc00426ffe0 sp=0xc00426ff78 pc=0xb0aeb7
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00426ffe8 sp=0xc00426ffe0 pc=0x4d1d21
created by server/queue.SendMsg
    /tmp/test-server/queue/consumer.go:132 +0xb4f

**Go Version : **

1.18

**Confluent Kakfa Version : **

github.com/confluentinc/confluent-kafka-go v1.9.1

kafka consumer configurations :

"consumer": {
    "queued.max.messages.kbytes.int": "1000000",
    "fetch.message.max.bytes.int": "1048576",
    "receive.message.max.bytes.int": "100000000",
    "max.partition.fetch.bytes.int": "1048576",
    "auto.offset.reset.string": "latest",
    "enable.auto.commit.boolean": "true",
    "auto.commit.interval.ms.int": "5000",
    "socket.keepalive.enable.boolean": "true",
    "metadata.max.age.ms.int": "900000",
    "session.timeout.ms.int": "30000",
    "heartbeat.interval.ms.int": "3000",
    "max.poll.interval.ms.int": "60000",
    "metadata.request.timeout.ms.int": "30000",
    "topic.metadata.refresh.interval.ms.int": "120000",
    "socket.timeout.ms.int": "10000",
    "fetch.wait.max.ms.int": "100",
    "statistics.interval.ms.int": "25000"
}

Kafka producer configuration :

"producer": {
    "socket.keepalive.enable.boolean": "true",
    "metadata.max.age.ms.int": "900000",
    "metadata.request.timeout.ms.int": "30000",
    "topic.metadata.refresh.interval.ms.int": "120000",
    "retries.int": "1000000",
    "message.timeout.ms.int": "300000",
    "socket.timeout.ms.int": "10000",
    "max.in.flight.requests.per.connection.int": "5",
    "enable.idempotence.boolean": "true",
    "statistics.interval.ms.int": "25000"
}

Can you please help me on fixing this issue. Thanks in advance.

Kafka publish to happen without errors but it is failing with segmentation violation error.


问:
Discord error: Unable to assign roles thorugh csv file
```<code>Traceback (most recent call last):
  File "C:\Users\Ankita ghosh\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\Ankita ghosh\Desktop\Discord\bot.py", line 19, in on_ready
    role =discord.utils.get(user.guild.roles, id=int(role_id))
AttributeError: 'NoneType' object has no attribute 'guild'
</code>```

I am trying to make a Discord bot that assigns a user the roles according to a CSV file but I am getting this error.

Here is my code:

```<code>import discord
import csv
import discord.utils
from discord.ext import commands
import os

intents = discord.Intents.default()
client = discord.Client(command_prefix='!', intents=intents)

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))
    with open('mycsvfile.csv', mode='r') as csv_file:
        csv_reader = csv.DictReader(csv_file)
        for row in csv_reader:
            user_id = row['user_id']
            role_id = row['role_id']
            user =discord.utils.find(lambda u: u.id == int(user_id), client.get_all_members())
            role =discord.utils.get(user.guild.roles, id=int(role_id))
            await user.add_roles(role)
            print(f'Role {role.name} has been added to {user.name}')

client.run(os.getenv('TOKEN'))
</code>```

I tried to read the CSV file and assign roles according to it and got the same error.

Body:
Traceback (most recent call last):
  File "C:\Users\Ankita ghosh\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\Ankita ghosh\Desktop\Discord\bot.py", line 19, in on_ready
    role =discord.utils.get(user.guild.roles, id=int(role_id))
AttributeError: 'NoneType' object has no attribute 'guild'

I am trying to make a Discord bot that assigns a user the roles according to a CSV file but I am getting this error.

Here is my code:

import discord
import csv
import discord.utils
from discord.ext import commands
import os

intents = discord.Intents.default()
client = discord.Client(command_prefix='!', intents=intents)

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))
    with open('mycsvfile.csv', mode='r') as csv_file:
        csv_reader = csv.DictReader(csv_file)
        for row in csv_reader:
            user_id = row['user_id']
            role_id = row['role_id']
            user =discord.utils.find(lambda u: u.id == int(user_id), client.get_all_members())
            role =discord.utils.get(user.guild.roles, id=int(role_id))
            await user.add_roles(role)
            print(f'Role {role.name} has been added to {user.name}')

client.run(os.getenv('TOKEN'))

I tried to read the CSV file and assign roles according to it and got the same error.


问:
Every Post routes gives 419 page expired error in laravel even if csrf token is there
My project developed using laravel6 on apache2. It is working properly in my local system.

When I deployed that project in staging server, My project's all routes are working. but all POST routes gives 419 page expired error even if there is CSRF token in every form.

Login screen appears but after I click on submit button post route is called and it gives me 419 error.

I also created one custom route for testing. but it will give same 419 error. In short, my every post route is giving 419 error.

I checked with giving necessary permission to storage folder, cache folder, also changed env configuration setting( SESSION_DOMAIN, SESSION_SECURE_COOKIE). but no any solution worked.

Is there any apache misconfiguration?


问:
How can I disable screenshot in cordova ios platform?
I am trying to prevent screenshot functionality in the entire app. How can I achieve it. Any help will be appreciated. I am using Cordova iOS platform 5.1.1 version.

I tried plugins like Cordova-plugin-prevent-screenshot, Cordova-plugin-privacy screen, Cordova-plugin-prevent-screenshot-c-office. Nothing seem to work. Any help will be appreciated. Thank you in advance.


问:
The following code generates JavaScript heap out of memory. Why and how to solve it?
The following code seems like very simple, but I have no idea why it generates a "heap out of memory" when size is bigger. The nodejs v18.12.1 is using.

```<code>#!/usr/bin/node
import fs from "node:fs"
import path from "node:path"
import http from 'node:http'
const port = process.argv[2] || 8080
const baseDir = process.argv[3] || "/tmp/"

function log(msg){
  if(!msg) return
  let now = new Date()
  let ts = now.toLocaleTimeString()
  let tsdate = now.toLocaleDateString().replace(/\//ig,"-")
  fs.appendFile(path.join(baseDir,"fileUpload" + tsdate + ".log"), ts + " " + msg + "\n", (err)=>{
    if(err) console.log(err)
  })
}

http.createServer((req, res) => {
  if (req.url != '/generate' || req.method !== 'GET') {
    log(req.headers.host + " " + req.method + " " + req.url + " " + req.headers.size + " usage_fail")
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    return res.end("wrong usage\n")
  }
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  for(let i = 0; i<req.headers.size; ++i ){
    res.write("-")
  }
  return res.end()
}).listen(port, (err) => {
  console.log('Server listening on http://localhost:' + port,err)
})

/*
curl -o /tmp/zfile.txt -H "size:100" http://localhost:8080/generate
 */

</code>```

The exact error message is described as follows.

```<code><--- Last few GCs --->

[3886618:0x1c854110]    87940 ms: Mark-sweep (reduce) 2028.6 (2058.0) -> 2028.3 (2058.0) MB, 8189.7 / 0.0 ms  (+ 45.6 ms in 5 steps since start of marking, biggest step 13.3 ms, walltime since start of marking 8260 ms) (average mu = 0.112, current mu = 0.[3886618:0x1c854110]    88011 ms: Scavenge (reduce) 2035.4 (2064.3) -> 2034.4 (2064.3) MB, 5.9 / 0.0 ms  (average mu = 0.112, current mu = 0.045) allocation failure;

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb5eb0c node::Abort() [/usr/bin/node]
 2: 0xa81dc0 void node::FPrintF<>(_IO_FILE*, char const*) [/usr/bin/node]
 3: 0xd1ee70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0xd1f040 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0xefd37c  [/usr/bin/node]
 6: 0xefdfe4 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/bin/node]
 7: 0xf0e534  [/usr/bin/node]
 8: 0xf0f0f8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 9: 0xeeb490 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
10: 0xeec468 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
11: 0xecf0f8 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
12: 0x127422c v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
13: 0x165bbcc  [/usr/bin/node]
Aborted (core dumped)
</code>```

The curl command can assign a size in header. The size indicates how many bytes will be generated to be downloaded. The code results very well when the size is very small, such as less than 1000. However, when the size is larger and larger, such as 99999999, the server side crashes, and generate the above error messages.

I know that manually increasing the heap memory usage of nodejs is a possible solution, but the method should not be good enough. The core of the code is a simple for loop, and write() function.  Why the code generates allocation problem?

I tried the above code on a Jetson Xavier NX which has ARM-based CPU and 8 GB memory. Nodejs is v18.12.1. I expect this code can generate arbitrary size, at least 1 GB, of file content to be downloaded.

Body:
The following code seems like very simple, but I have no idea why it generates a "heap out of memory" when size is bigger. The nodejs v18.12.1 is using.

#!/usr/bin/node
import fs from "node:fs"
import path from "node:path"
import http from 'node:http'
const port = process.argv[2] || 8080
const baseDir = process.argv[3] || "/tmp/"

function log(msg){
  if(!msg) return
  let now = new Date()
  let ts = now.toLocaleTimeString()
  let tsdate = now.toLocaleDateString().replace(/\//ig,"-")
  fs.appendFile(path.join(baseDir,"fileUpload" + tsdate + ".log"), ts + " " + msg + "\n", (err)=>{
    if(err) console.log(err)
  })
}

http.createServer((req, res) => {
  if (req.url != '/generate' || req.method !== 'GET') {
    log(req.headers.host + " " + req.method + " " + req.url + " " + req.headers.size + " usage_fail")
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    return res.end("wrong usage\n")
  }
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  for(let i = 0; i<req.headers.size; ++i ){
    res.write("-")
  }
  return res.end()
}).listen(port, (err) => {
  console.log('Server listening on http://localhost:' + port,err)
})

/*
curl -o /tmp/zfile.txt -H "size:100" http://localhost:8080/generate
 */

The exact error message is described as follows.

<--- Last few GCs --->

[3886618:0x1c854110]    87940 ms: Mark-sweep (reduce) 2028.6 (2058.0) -> 2028.3 (2058.0) MB, 8189.7 / 0.0 ms  (+ 45.6 ms in 5 steps since start of marking, biggest step 13.3 ms, walltime since start of marking 8260 ms) (average mu = 0.112, current mu = 0.[3886618:0x1c854110]    88011 ms: Scavenge (reduce) 2035.4 (2064.3) -> 2034.4 (2064.3) MB, 5.9 / 0.0 ms  (average mu = 0.112, current mu = 0.045) allocation failure;

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb5eb0c node::Abort() [/usr/bin/node]
 2: 0xa81dc0 void node::FPrintF<>(_IO_FILE*, char const*) [/usr/bin/node]
 3: 0xd1ee70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0xd1f040 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0xefd37c  [/usr/bin/node]
 6: 0xefdfe4 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/bin/node]
 7: 0xf0e534  [/usr/bin/node]
 8: 0xf0f0f8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 9: 0xeeb490 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
10: 0xeec468 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
11: 0xecf0f8 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
12: 0x127422c v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
13: 0x165bbcc  [/usr/bin/node]
Aborted (core dumped)

The curl command can assign a size in header. The size indicates how many bytes will be generated to be downloaded. The code results very well when the size is very small, such as less than 1000. However, when the size is larger and larger, such as 99999999, the server side crashes, and generate the above error messages.

I know that manually increasing the heap memory usage of nodejs is a possible solution, but the method should not be good enough. The core of the code is a simple for loop, and write() function.  Why the code generates allocation problem?

I tried the above code on a Jetson Xavier NX which has ARM-based CPU and 8 GB memory. Nodejs is v18.12.1. I expect this code can generate arbitrary size, at least 1 GB, of file content to be downloaded.


问: npm script does not run through npm run

Title: npm script does not run through npm run <script-name> but runs when typed directly

Body:
I am trying to deploy an application on an aws linux machine. I wrote scripts to be run on Linux (for when I learn how to use pipelines in the future). For now, I created the windows-equivalent commands to be able to run the scripts on my machine.

Problem: When I try to run npm run build_win, the script would exit at tsc. However, when I take the rest of the script cp -rf src/config www/config && cp -R .elasticbeanstalk www/.elasticbeanstalk && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd .. and run it directly in PowerShell terminal, it works. Why does not npm run build_win work?

"scripts": {
    "clean": "rm -rf www/ || true",
    "build": "npm install . && npm run clean && tsc && cp -rf src/config www/config && cp -R .elasticbeanstalk www/.elasticbeanstalk && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd ..",
    "clean_win": "rmdir /s /q www || (exit 0)",
    "build_win": "cp -r src/config www/config && cp -R .elasticbeanstalk www/.elasticbeanstalk && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd ..",
  },


问:
log4j2 - DefaultRolloverStrategy max value given 1000 but making at max 100
I have used DefaultRolloverStrategy for rolling files in which if I am giving max value less than 100 it is working ax expected that if assigned 50 it is making at max 50 files but when max set to greater than 100 like 200 or 1000 it is making at max 100 files.

Like in this case i have set max file size 1 kb so it will rollover when it file exceeds 1 kb and log.info.file.pattern is %d{yyyy-MM-dd}-%03i.log.gz so it is day based and max in defaultrolloverstrategy is 1000

```<code><?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.example">
    <Properties>
        <!--        <property name="FILE_SIZE">${bundle:application:max.file.size}</property>-->
        <property name="FILE_SIZE">${sys:max.file.size:-1 KB}</property>
        <property name="infoLogFileName">${sys:log.info.file.name:-./logs/app-all.log}</property>
        <property name="warnLogFileName">${sys:log.warn.file.name:-./logs/app-warn.log}</property>
        <property name="kafkaLogFileName">${sys:log.kafka.file.name:-./logs/app-kafka.log}</property>

        <property name="infoLogFilePattern">${sys:log.info.file.pattern}</property>
       <property name="warnLogFilePattern">${sys:log.warn.file.pattern}</property>
        <property name="kafkaLogFilePattern">${sys:log.kafka.file.pattern}</property>

        <property name="consolePatternLayout">${sys:console.pattern:-}</property>
        <property name="numberOfRolloverFiles">${sys:rollover.files:-1000}</property>
        <property name="logLevel">${sys:log.level:-INFO}</property>
``
    </Properties>
    <ThresholdFilterCustom />
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout
                    pattern="${consolePatternLayout}" />
        </Console>

        <RollingFile name="infoLogFile"
                     fileName="${infoLogFileName}"
                     filePattern="${infoLogFilePattern}">
            <LevelRangeFilter minLevel="FATAL" maxLevel="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="1000"/>
        </RollingFile>

        <RollingFile name="warnLogFile"
                     fileName="${warnLogFileName}"
                     filePattern="${warnLogFilePattern}">
            <LevelRangeFilter minLevel="FATAL" maxLevel="WARN" onMatch="ACCEPT" onMismatch="DENY"/>

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="${numberOfRolloverFiles}"/>
        </RollingFile>

        <RollingFile name="kafkaLogFile"
                     fileName="${kafkaLogFileName}"
                     filePattern="${kafkaLogFilePattern}">

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="${numberOfRolloverFiles}"/>
        </RollingFile>

    </Appenders>

    <Loggers>
        <!-- LOG everything at INFO level -->
        <Root level="${logLevel}">
            <AppenderRef ref="Console" />
            <AppenderRef ref="infoLogFile" />
            <AppenderRef ref="warnLogFile" />

        </Root>

        <!-- LOG "com.baeldung*" at TRACE level. This has no effect, as we're doing from command line -->
        <Logger name="org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer" level="ERROR" ></Logger>
        <Logger name="org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient" level="ERROR"></Logger>
        <Logger name="org.springframework.kafka.support.LoggingProducerListener" level="INFO" additivity="false">
            <appender-ref ref="kafkaLogFile" />
        </Logger>

    </Loggers>

</Configuration>
</code>```

Body:
I have used DefaultRolloverStrategy for rolling files in which if I am giving max value less than 100 it is working ax expected that if assigned 50 it is making at max 50 files but when max set to greater than 100 like 200 or 1000 it is making at max 100 files.

Like in this case i have set max file size 1 kb so it will rollover when it file exceeds 1 kb and log.info.file.pattern is %d{yyyy-MM-dd}-%03i.log.gz so it is day based and max in defaultrolloverstrategy is 1000

<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.example">
    <Properties>

        <property name="FILE_SIZE">${sys:max.file.size:-1 KB}</property>
        <property name="infoLogFileName">${sys:log.info.file.name:-./logs/app-all.log}</property>
        <property name="warnLogFileName">${sys:log.warn.file.name:-./logs/app-warn.log}</property>
        <property name="kafkaLogFileName">${sys:log.kafka.file.name:-./logs/app-kafka.log}</property>

        <property name="infoLogFilePattern">${sys:log.info.file.pattern}</property>
       <property name="warnLogFilePattern">${sys:log.warn.file.pattern}</property>
        <property name="kafkaLogFilePattern">${sys:log.kafka.file.pattern}</property>

        <property name="consolePatternLayout">${sys:console.pattern:-}</property>
        <property name="numberOfRolloverFiles">${sys:rollover.files:-1000}</property>
        <property name="logLevel">${sys:log.level:-INFO}</property>
``
    </Properties>
    <ThresholdFilterCustom />
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout
                    pattern="${consolePatternLayout}" />
        </Console>

        <RollingFile name="infoLogFile"
                     fileName="${infoLogFileName}"
                     filePattern="${infoLogFilePattern}">
            <LevelRangeFilter minLevel="FATAL" maxLevel="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="1000"/>
        </RollingFile>

        <RollingFile name="warnLogFile"
                     fileName="${warnLogFileName}"
                     filePattern="${warnLogFilePattern}">
            <LevelRangeFilter minLevel="FATAL" maxLevel="WARN" onMatch="ACCEPT" onMismatch="DENY"/>

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="${numberOfRolloverFiles}"/>
        </RollingFile>

        <RollingFile name="kafkaLogFile"
                     fileName="${kafkaLogFileName}"
                     filePattern="${kafkaLogFilePattern}">

            <PatternLayout>
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%t]  %logger{36}         : %msg%n</pattern>
            </PatternLayout>
            <Policies>

                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy
                        size="${FILE_SIZE}" />
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="${numberOfRolloverFiles}"/>
        </RollingFile>

    </Appenders>

    <Loggers>

        <Root level="${logLevel}">
            <AppenderRef ref="Console" />
            <AppenderRef ref="infoLogFile" />
            <AppenderRef ref="warnLogFile" />

        </Root>

        <Logger name="org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer" level="ERROR" ></Logger>
        <Logger name="org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient" level="ERROR"></Logger>
        <Logger name="org.springframework.kafka.support.LoggingProducerListener" level="INFO" additivity="false">
            <appender-ref ref="kafkaLogFile" />
        </Logger>

    </Loggers>

</Configuration>


问:
php artisan db:show does not refresh table sizes afrer truncating
If you're using MySQL setting:

```<code>innodb_file_per_table=ON
</code>```

You free disk space when removing records from tables, but in order to refresh statistics once you a table free space, it's required by MySQL to run ANALYZE TABLE your_table.

I'd like to know if theres's a way to do this refresh via artisan command or some other out-of-the-box way provided by Laravel.

Body:
If you're using MySQL setting:

innodb_file_per_table=ON

You free disk space when removing records from tables, but in order to refresh statistics once you a table free space, it's required by MySQL to run ANALYZE TABLE your_table.

I'd like to know if theres's a way to do this refresh via artisan command or some other out-of-the-box way provided by Laravel.


问:
electron clipboard and nativeIamge api won't work properly on mac
After copy a doc file on desktop， i use this api clipboard.readImage().isEmpty() to judge if it was a picture , it returned true. it should not return true because there is no picture in clipboard , it was a doc file. It worked correctly on windows.

how could i do to make it return the correct value on mac


问:
How to schedule query in BigQuery inside cloud function
I want to schedule a query inside a BQ project using cloud function written in python.
I have been following up with this link - https://cloud.google.com/bigquery/docs/samples/bigquerydatatransfer-create-scheduled-query

But there is no destination dataset as it is a DML command and failing.


问:
How can I add collisions to Trail Renderer? 2D
I have a bullet and the trailrenderer following it. I want to add collision to this Trail Renderer.

created something like a laser beam. It has an invisible bullet at its tip. My problem is that I can't add collisions to the trail renderer that follows it.

My bullet shape its a circle.


问:
Why Program Control is not fetching consumer message from claim?
I am trying to implement a Kafka Consumer Group using shopify sarama client. I am kind of confused, how should a  ConsumerGroupHandler be used. Since, I don't know session and claim object. How can I use ConsumeClaim.

Is there some code, I am missing?

```<code>package kf

import (
    "context"
    "fmt"
    "github.com/Shopify/sarama"
)

type Consumer struct {
    flowEventReader sarama.ConsumerGroup
    topic           string
    brokerUrls      []string
}

func InitConsumer(brokers []string, topic string) *Consumer {
    c := &Consumer{}
    c.topic = topic
    c.brokerUrls = brokers
    var (
        err error
    )
    conf := createSaramaKafkaConf()
    c.flowEventReader, err = sarama.NewConsumerGroup(c.brokerUrls, "flowExecutor", conf)
    if err != nil {
        panic("failed to create consumer group on kafka cluster")
    }
    return c
}

func (c *Consumer) HandleMessages() {
    // Consume from kafka and process
    for {
        err := c.flowEventReader.Consume(context.Background(), []string{c.topic}, exampleConsumerGroupHandler{})
        if err != nil {
            fmt.Errorf("FAILED")
        }
    }

}

type exampleConsumerGroupHandler struct{}

func (exampleConsumerGroupHandler) Setup(_ sarama.ConsumerGroupSession) error   { return nil }
func (exampleConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
func (h exampleConsumerGroupHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
    for msg := range claim.Messages() {
        fmt.Printf("Message topic:%q partition:%d offset:%d\n", msg.Topic, msg.Partition, msg.Offset)
        sess.MarkMessage(msg, "")
    }
    return nil
}

func createSaramaKafkaConf() *sarama.Config {
    conf := sarama.NewConfig()
    version := "2.6.2"
    kafkaVer, err := sarama.ParseKafkaVersion(version)
    if err != nil {
        panic("failed to parse kafka version, executor will not run")
    }
    conf.Version = kafkaVer
    conf.Consumer.Offsets.Initial = sarama.OffsetOldest
    conf.Consumer.Group.Rebalance.GroupStrategies = []sarama.BalanceStrategy{sarama.BalanceStrategySticky}

    return conf
}
</code>```

Please help me out.

Body:
I am trying to implement a Kafka Consumer Group using shopify sarama client. I am kind of confused, how should a  ConsumerGroupHandler be used. Since, I don't know session and claim object. How can I use ConsumeClaim.

Is there some code, I am missing?

package kf

import (
    "context"
    "fmt"
    "github.com/Shopify/sarama"
)

type Consumer struct {
    flowEventReader sarama.ConsumerGroup
    topic           string
    brokerUrls      []string
}

func InitConsumer(brokers []string, topic string) *Consumer {
    c := &Consumer{}
    c.topic = topic
    c.brokerUrls = brokers
    var (
        err error
    )
    conf := createSaramaKafkaConf()
    c.flowEventReader, err = sarama.NewConsumerGroup(c.brokerUrls, "flowExecutor", conf)
    if err != nil {
        panic("failed to create consumer group on kafka cluster")
    }
    return c
}

func (c *Consumer) HandleMessages() {
    // Consume from kafka and process
    for {
        err := c.flowEventReader.Consume(context.Background(), []string{c.topic}, exampleConsumerGroupHandler{})
        if err != nil {
            fmt.Errorf("FAILED")
        }
    }

}

type exampleConsumerGroupHandler struct{}

func (exampleConsumerGroupHandler) Setup(_ sarama.ConsumerGroupSession) error   { return nil }
func (exampleConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
func (h exampleConsumerGroupHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
    for msg := range claim.Messages() {
        fmt.Printf("Message topic:%q partition:%d offset:%d\n", msg.Topic, msg.Partition, msg.Offset)
        sess.MarkMessage(msg, "")
    }
    return nil
}

func createSaramaKafkaConf() *sarama.Config {
    conf := sarama.NewConfig()
    version := "2.6.2"
    kafkaVer, err := sarama.ParseKafkaVersion(version)
    if err != nil {
        panic("failed to parse kafka version, executor will not run")
    }
    conf.Version = kafkaVer
    conf.Consumer.Offsets.Initial = sarama.OffsetOldest
    conf.Consumer.Group.Rebalance.GroupStrategies = []sarama.BalanceStrategy{sarama.BalanceStrategySticky}

    return conf
}

Please help me out.


问:
Not Able to Upload File on Amazon S3 using Stream
I am getting the below exception while uploading file to S3 AWS using DOT net core

```<code>{"Error making request with Error Code Forbidden and Http Status Code Forbidden. No further error information was returned by the service."}
</code>```

I tried all these things to debug this :

Install AWS CLI and configure using aws configure

Added permission as AmazonS3FullAccess to user.

Code :

```<code> var clientq = new Amazon.S3.AmazonS3Client(AccessKey, SecretKey, RegionEndpoint.APSouth1);
                var doesS3BucketExist = await AmazonS3Util.DoesS3BucketExistV2Async(clientq, BucketName);

                byte[] fileByte = new Byte[file.Length];
                file.OpenReadStream().Read(fileByte, 0, Int32.Parse(file.Length.ToString()));

                if (doesS3BucketExist)
                {

                    using (var stream = new MemoryStream(fileByte))
                    {
                        var request = new PutObjectRequest
                        {
                            BucketName = BucketName,
                            Key = file.FileName,
                            InputStream = stream,
                            ContentType = file.ContentType
                        };
                        // specify no ACL, else upload will be blocked by S3!
                       var response = await clientq.PutObjectAsync(request);
                    }

                    return true;
                }
</code>```

Also, i have observed when i am using InputStream = stream, then i am getting this exception.

Can anyone help me on this ?

Body:
I am getting the below exception while uploading file to S3 AWS using DOT net core

{"Error making request with Error Code Forbidden and Http Status Code Forbidden. No further error information was returned by the service."}

I tried all these things to debug this :

Install AWS CLI and configure using aws configure

Added permission as AmazonS3FullAccess to user.

Code :

 var clientq = new Amazon.S3.AmazonS3Client(AccessKey, SecretKey, RegionEndpoint.APSouth1);
                var doesS3BucketExist = await AmazonS3Util.DoesS3BucketExistV2Async(clientq, BucketName);

                byte[] fileByte = new Byte[file.Length];
                file.OpenReadStream().Read(fileByte, 0, Int32.Parse(file.Length.ToString()));

                if (doesS3BucketExist)
                {

                    using (var stream = new MemoryStream(fileByte))
                    {
                        var request = new PutObjectRequest
                        {
                            BucketName = BucketName,
                            Key = file.FileName,
                            InputStream = stream,
                            ContentType = file.ContentType
                        };
                        // specify no ACL, else upload will be blocked by S3!
                       var response = await clientq.PutObjectAsync(request);
                    }

                    return true;
                }

Also, i have observed when i am using InputStream = stream, then i am getting this exception.

Can anyone help me on this ?


问:
What practical effect will setting delegate="true" have in tomcat?
The documentation says (about the delegate flag):

Set to true if you want the class loader to follow the standard Java2 delegation model, and attempt to load classes from parent class loaders before looking inside the web application. Set to false (the default) to have the class loader look inside the web application first, before asking parent class loaders to find requested classes or resources.

When should this flag be enabled?

What practical effect will the inclusion of this flag have?


问:
Unauthorized access at ASP.global.asax file in webforms application
the application throw 500 runtime error. And the after some time the application starts working fine. After fetching the event logs we found the below mentioned unhandled exception.

Process information:    Process ID: 75788     Process name: w3wp.exe     Account name: IIS APPPOOL\XX
Exception information:    Exception type: HttpException     Exception message: Unauthorized access   at ASP.global_asax.Application_PreRequestHandlerExecute(Object sender, EventArgs e)   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Please Note without any changes in the application or at server level it starts working again after some time.

We have checked, proper access rights have been provided to the Application folder mapped on the IIS.