Feign mixing up two separate request/response within the same client

Aperta
#2,125 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
java, spring-boot
Ambito
api, backend

Direzione di ricerca

Inizia con l’interfaccia Feign PlaceholderResource e FeignConfiguration, quindi confronta i log delle richieste concorrenti, gli URL e gli identificativi di correlazione mostrati nel report. Il lavoro è completato quando viene riprodotto lo scambio delle risposte tra richieste e viene identificato il componente o la configurazione Feign responsabile di restituire a una chiamata API la risposta di un’altra.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feedback provided spring-cloud

Hi

I have been using feign for calls from one spring boot application to another in an infrastructure which has a large volume of API calls. Recently I have been getting an intermittent issue which says that the response received to one of the feign client calls cannot be resolved to the Object that it expects. Upon further debugging, I saw that the response received on this feign call is an unexpected response as it is supposed to be received on a completely different feign call.

Feign logs:

Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] ---> GET http://placeholder-url.com/v5/getplaceholdertype/123/type/1234 HTTP/1.1
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] X-MM-CORRELATION-ID: correlation-id-1
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] ---> END HTTP (0-byte body)
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] <--- HTTP/1.1 200 OK (0ms)
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] content-type: application/json
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] link: <http://placeholder-url.com/v5/api/getplaceholderobject/123/user/123123/placeholderobject?param1=123123&param2=true&param3=false&page=-1&size=100>; rel="last" <http://placeholder-url.com/v5/api/getplaceholderobject/123/user/123123/placeholderobject?param1=123123&param2=true&param3=false&page=-1&size=100>; rel="first"
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] vary: accept-encoding
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] x-mm-correlation-id: correlation-id-2
Jul 5, 2023 @ 18:33:44.518	[PlaceholderResource#getPlaceholderType] date: Wed 05 Jul 2023 14:33:34 GMT
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] x-total-count: 0
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] x-result-count: 0-0/0
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] []
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] <--- END HTTP (2-byte body)
Jul 5, 2023 @ 18:33:44.519	[PlaceholderResource#getPlaceholderType] 

The URL returned in the link header is sent back from a different URL used for getPlaceholderObjects API and not the getPlaceholderType API

This [] response is expected for the getPlaceholderObjects API. Even the correlation ID header we're receiving is for a different API call which is supposed to be running in a different thread.

Feign interface:

@FeignClient(
		name = "placeholderResource",
		url = "${placeholder.api.url}")
@Headers("Content-Type: application/json")
public interface PlaceholderResource {

	/**
	 * Get placeholder type
	 */
	@GetMapping(
			value = "/getplaceholdertype/{referrerId}/type/{placeholderTypeId}")
	PlaceholderType getPlaceholderType(@PathVariable("referrerId") final Integer referrerId,
			@PathVariable("placeholderTypeId") final Long placeholderTypeId);

	/**
	 * Get placeholder object(s)
	 */
	@GetMapping(
			value = "/getplaceholderobject/{referrerId}/user/{userId}/placeholderobject")
	PlaceholderObject[] getPlaceholderObjects(@PathVariable("referrerId") final Integer referrerId,
			@PathVariable("userId") final Long userId,
			@RequestParam("param1") final List<Long> param1,
			@RequestParam("param2") final String param2,
			@RequestParam("param3") final Boolean param3);
}

Feign configuration:

/**
 * Configuration class for feign client(s).
 */
@Configuration
@EnableDiscoveryClient
public class FeignConfiguration {

	@Bean
	public FeignClientEncodingProperties feignClientEncodingProperties() {
		return new FeignClientEncodingProperties();
	}

	@Bean
	public ErrorDecoder feignErrorDecoder() {
		return new CustomFeignErrorDecoder();
	}
}
Lingua principale
Java
Stelle
9.8k
Fork
2k
Merge medio
1h 15m
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenFeign/feign

Tutte le issue di OpenFeign/feign

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.