Upstreams and failover

Hi all, I’ve almost the same problem. I would like to share my kong.yml because in the end @likarev did not provide examples or configurations leading to this behaviour.

I have a service and a related upstream with two targets. To simulate failover, one target always gives 500 on a certain path, the other one 200. Targets have the same weight.
If I send 100 requests I would like to receive all 200. Instead I receive between 3 and 15 500 errors, depending on how I change some values about retries, success, http_failures and so on.

Here you are my configs:

_format_version: '1.1'

services:
- name: my-service
  host: my-upstream
  port: 8000
  protocol: http
  retries: 3
  routes:
  - name: my-route
    paths:
    - /

upstreams:
- name: my-upstream
  targets:
  - target: 192.168.3.23:10102
    weight: 50
  - target: 192.168.3.28:10102
    weight: 50
  healthchecks:
    active:
      concurrency: 100
      healthy:
        http_statuses:
        - 200
        - 302
        interval: 1
        successes: 1
      http_path: /testKong
      timeout: 1
      type: http
      unhealthy:
        http_failures: 3
        http_statuses:
        - 429
        - 404
        - 500
        - 501
        - 502
        - 503
        - 504
        - 505
        interval: 1
        tcp_failures: 3
        timeouts: 3
    passive:
      healthy:
        http_statuses:
        - 200
        - 201
        - 202
        - 203
        - 204
        - 205
        - 206
        - 207
        - 208
        - 226
        - 300
        - 301
        - 302
        - 303
        - 304
        - 305
        - 306
        - 307
        - 308
        successes: 1
      type: http
      unhealthy:
        http_failures: 1
        http_statuses:
        - 429
        - 500
        - 503
        tcp_failures: 1
        timeouts: 1
  slots: 100

Any suggestion? The two targets have the same weight, so (as far as I understand) 50% of requests go to the unhealthy server. But I do not receive 50 errors, much less. So, many requests are correctly redirected and some of them do not. Am i right?

Thanks