is there anyway that can help me increase the timeout of the swagger request that i issue to my RestAPI using " Try it out" of swagger ?
i roamed the internet and disn't find something usefull, and i tried to add things to my yml conf files, but i didn't know what to write
i expected to find something like this maybe :
swagger.timeout=5000
i have a spring boot application using swagger in order to test my webservices in a restController. i have a treatement that takes about 30 seconds, the thing that makes swagger throw a 500 timeout error for me.
thanks !
As far as I know, Swagger registers its endpoints as normal Spring controllers so use the underlying web container to serve its traffic.
Try to increase the global connection timeout:
server.connection-timeout=120000
Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout.
solved by adding this to ZUUL's (API Gateway)
ribbon:
ReadTimeout: 120000
ConnectTimeout: 120000
Related
I have a Spring Boot/Spring Security application made via Java 16 and Spring Boot v2.7.5 and running on embedded Tomcat server.
The strange thing about it that I've indicated session timeout to 4 hours using application.properties (can be found below), but when I do POST request after e.g. 3.5 hours of inactivity the session expires despite this setting and redirects me to login screen. Moreover, I've done several checks to investigate this issue and I've figured out that if I do a GET request instead then the session remains and then I can do any request I want without timeout.
Could you advise what can trigger such behaviour, please?
My first thoughts were about cookies and/or CSRF token lifetime. However, looks like CSRF token has no expiration time and it remains the same all the time the session exists. The same thing is about JSESSIONID cookie behavior by default. However, I also tried to set server.servlet.session.cookie.max-age property to 4 hours and it didn't work neither.
Please note, that if I set session timeout to quite lower values like default 30 minutes, everything works as intended. Also, I've checked session timeout internaly after server is running using RestController and calling HttpServletRequest.getSession().getMaxInactiveInterval() and the returning value was always equal to server.servlet.session.timeout value, so looks like nothing overrides this property or something.
Thank you for the answers in advance!
Please take a look at my application.properties document below:
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://uri;databaseName=DBName
spring.datasource.username=user
spring.datasource.password=pwd
spring.datasource.hikari.connectionTimeout=400000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.maxLifetime=1800000
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServerDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=false
server.servlet.session.timeout=240m
server.error.whitelabel.enabled=true
server.error.include-message=never
server.error.include-binding-errors=never
logging.file.path=./log/
spring.web.resources.cache.cachecontrol.no-store=true
spring.web.resources.cache.cachecontrol.must-revalidate=true
spring.mail.host=smtp.com
spring.mail.properties.mail.smtp.ssl.trust=smtp.com
spring.mail.port=587
spring.mail.username=user#email.com
spring.mail.password=pwd
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
server.port=443
server.ssl.key-store-type=PKCS12
server.ssl.key-store=keystore.p12
server.ssl.key-store-password=pwd
server.ssl.key-alias=tomcat
I am developing a Quarkus application and using RESTEasy Reactive. One of the endpoints receives a multipart/form-data mime type object but when I try to use it sometimes the "413 - Request Entity too Large" error occurs.
After digging the Quarkus documentation, the property you really need to configure is this:
quarkus.http.limits.max-form-attribute-size
I have set this to 4M (4 megabytes), like this, on my application.yaml file, but of course you can configure it for any value you may want:
quarkus:
http:
limits:
max-form-attribute-size: 4M
Keep in mind that if you are using an application.properties file instead, you should do it like this:
quarkus.http.limits.max-form-attribute-size=4M
I have a spring MVC endpoint returning StreamingResponseBody so I can stream big file instead of keeping it in memory.
The request can take a while to download so it is timing out. I can fix it by setting spring.mvc.async.request-timeout=360000, but I don't want this setting to apply globally to all endpoints.
Is there way to set request-timeout only for this specific endpoint?
I did find Set timeout for specific async request in Spring-boot, but I don't think that applies to my code using StreamingResponseBody.
I have also found Spring REST endpoint returning StreamingResponseBody: AsyncRequestTimeoutException after 30 seconds, which doesn't have the desired effect.
I have a SpringBoot 2 app that uses using Spring Data Couchbase.
I have this message on the logs every minute
2019-11-12 13:48:48,924 WARN : gid: trace= span= [cb-orphan-1] c.c.c.c.t.DefaultOrphanResponseReporter Orphan responses observed: [{"top":[{"r":"10.120.93.220:8092","s":"view","c":"5BE128F6F96A4D28/FFFFFFFFDA2C8C52","l":"10.125.216.233:49893"}],"service":"view","count":1}]
That is from the new Response Time Observability feature underlying the Java SDK.
It would seem to indicate that you have view requests which are timing out, but eventually received later, but I have no views defined in Couchbase DB
I would like to know if it is possible to disable OrphanResponseLogReporter via YML file config in a SpringBoot app. , setting the logIntervalNanos to 0
No, unfortunately, you cannot do it. Only a subset of Couchbase's configuration properties is supported in the application.yml, namely the ones present in the CouchbaseProperties.java class.
You could although use an environment variable: com.couchbase.orphanResponseReportingEnabled=false. It is independent of Spring, it's read directly by Couchbase SDK.
Edit:
As a workaround, you can set logging level in the application.yml:
logging.level.com.couchbase.client.core.tracing.DefaultOrphanResponseReporter: ERROR
I have configured the re delivery related properties as follows. In fact, I wanted to retry only for HTTP Code 500x series. But I see that onException() takes only exception type. How to achieve this? My application is spring boot & camel based.
errorHandler(defaultErrorHandler().maximumRedeliveries(3).redeliveryDelay(5000).logRetryAttempted(true).logExhausted(true));
onException().retryAttemptedLogLevel(LoggingLevel.WARN)
Camel 2.23 is the version I am using(As per the comment).
Need more information, how you get resp code.
if you get response from camel route you can add condition in route:
.choice().when().simple("header.HTTP_RESPONSE_CODE >= 500").errorHandler(defaultErrorHandler().maximumRedeliveries(3).redeliveryDelay(5000).logRetryAttempted(true).logExhausted(true)).end();