GeoApiContext should clean up working threads on exit.
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par com.google.maps.GeoApiContext, com.google.maps.OkHttpRequestHandler et com.google.maps.internal.RateLimitExecutorService, mentionnés dans la stack trace ; suivez la manière dont le chemin PlacesApi.placeAutocomplete crée et gère ses threads de travail. Reproduisez le cycle de vie de la requête signalé et vérifiez que les contextes peuvent se terminer sans laisser de threads natifs.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hello guys, I had a problem while doing a PlacesApi.placeAutocomplete request
I really don't know if that is a issue caused by the API or on our implementation.
We are developing an application that uses:
- Spring Boot
1.3.6.RELEASE Undertowcom.google.maps:google-maps-services:0.1.17
# application.properties
server.undertow.worker-threads=1000
server.undertow.io-threads=100
# EC2 AWS
m4.xlarge
# Dockerfile
FROM java:8
RUN apt-get update && apt-get install -y
WORKDIR /app
VOLUME /root/.gradle
COPY gradle/ /app/gradle/
COPY gradlew /app/gradlew
COPY build.gradle /app/build.gradle
COPY src/ /app/src/
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-jar","/app/build/libs/application-1.0.0.jar"]
# docker-entrypoint.sh
#!/bin/bash
set -e
./gradlew build -x test
exec "$@"
@Service
public class GoogleMapsAPIService {
public List placeAutoComplete(String input, Double latitude, Double longitude, String language) {
GeoApiContext context = new GeoApiContext().setApiKey(GOOGLEMAPS_KEY);
LatLng location = new LatLng(latitude, longitude); // -23.52488881961586,-46.67578987777233
AutocompletePrediction[] autocompletePredictions = PlacesApi.placeAutocomplete(context, input)
.location(location)
.language("pt-BR")
.radius(1000)
.awaitIgnoreError();
return assemblyPrediction(autocompletePredictions);
}
private List assemblyPrediction(AutocompletePrediction[] autoCompletePredictions) {
List<Prediction> predictions = new ArrayList<>();
for (AutocompletePrediction autocompletePrediction : autoCompletePredictions) {
String placeId = autocompletePrediction.placeId;
String title = autocompletePrediction.terms[0].value;
String subTitle = Arrays.stream(autocompletePrediction.terms).skip(1).map(term -> term.value).collect(Collectors.joining(", "));
predictions.add(new Prediction(placeId, title, subTitle));
}
return predictions;
}
}
Sometimes we get this exception:
2017-04-19 19:11:03,290 [XNIO-3 task-914] DEBUG org.springframework.web.servlet.DispatcherServlet - Last-Modified value for [/predictions] is: -1
2017-04-19 19:11:03,290 [XNIO-3 task-914] INFO com.application.services.GoogleMapsAPIService - GoogleMapsAPIService.placeAutoComplete
2017-04-19 19:11:03,290 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Passenger: [7459]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Input: [Alameda santos 2081]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Latitude: [-23.52488881961586]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Longitude: [-46.67578987777233]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Language: [pt-BR]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG com.application.services.GoogleMapsAPIService - > Radius: [1000]
2017-04-19 19:11:03,291 [XNIO-3 task-914] DEBUG org.springframework.web.servlet.DispatcherServlet - Could not complete request
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: unable to create new native thread
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1305)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:979)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:281)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at com.google.maps.internal.RateLimitExecutorService.<init>(RateLimitExecutorService.java:63)
at com.google.maps.OkHttpRequestHandler.<init>(OkHttpRequestHandler.java:49)
at com.google.maps.GeoApiContext.<init>(GeoApiContext.java:88)
at com.application.services.GoogleMapsAPIService.placeAutoComplete(GoogleMapsAPIService.java:175)
at com.application.controllers.PredictionsController.predictions(PredictionsController.java:31)
Stacktrace:
stacktrace.txt
Do you know what could causes that?
- Langage dominant
- Java
- Étoiles
- 1.8k
- Forks
- 972
- Merge moyen
- 5 h 7 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de googlemaps/google-maps-services-java
-
PlacesApi.placeDetails(context, placeId).await() interface errorPeut-être pris @madtriceps l’a pris il y a 99 jours. Ouvertetriage me type: bug
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
-
[email protected]Ouvertetriage me type: feature request
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 10/100
-
Bagg hacmOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 5/100
googlemaps/google-maps-services-java#1059 · 1 réaction ·
-
Issue in java daOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 10/100
-
Issue in java daOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 10/100
Toutes les issues de googlemaps/google-maps-services-java
Issues similaires
-
Area-UIUX Issue-Bug Issue-Easy (good first issue)
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
TeamAmaze/AmazeFileManager#4769 ·
Les mainteneurs répondent en général sous 7 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
open-feature/java-sdk#2076 ·
Les mainteneurs répondent en général sous 1 jour
-
Expose SManga.memo & SChapter.memo fields in GraphQL APIs to support source-specific client featuresOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Suwayomi/Suwayomi-Server#2551 ·
Les mainteneurs répondent en général sous 9 jours
-
CLI: enforce absolute ADB device paths in file and directory commandsPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
weaviate/java-client#631 ·