Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

Версия 3.5.0 ломает загрузку больших файлов #70

Closed as not planned

Description

@hookzof

Обновление 3.5 сломало загрузку больших файлов на высоконагруженном сервере (проверялось здесь @DC_Speed_Test на DC2/4), аномалия также видна на скриншоте ниже (яма на графике запуск 3.5 версии):

Image

Activity

  1. github-actions commented on Mar 27, 2026

    @github-actions

    Спасибо за обращение.

    Этот проект поддерживается одним разработчиком в свободное время.
    Upstream TelegramMessenger/MTProxy заброшен. Этот форк — единственная активно поддерживаемая версия.

    Развитие проекта зависит от поддержки сообщества:

    • GitHub Sponsors — issues спонсоров рассматриваются в приоритете
    • Донат через Tribute — карты, Россия
    • ЮMoney — карты и кошельки
    • Boosty
    • TON: UQBOGq_b3eL63Qfkj6ykoBibK3zGJDQzLK91v2q-UCY7BPeb (через @wallet в Telegram)
    • USDT (TRC-20): TNVSj1QjZ5jqdaeshe7VCpXWo2S1n936Hj
    • BTC: bc1qvxxldmanwggula7992uun5a2qxm65ej9h0unj7
    • GetPageSpeed RPM-пакеты — установка для продакшена с поддержкой

    Issues без активности сообщества могут быть закрыты через 60 дней.

  2. dvershinin commented on Mar 27, 2026

    @dvershinin

    Исправлено в v3.5.1.

    Причина: DRS-задержки между TLS-записями (Weibull, ~7 мс в среднем) применялись после каждой записи, ограничивая скорость загрузки больших файлов до ~2 МБ/с.

    Исправление: задержки теперь автоматически пропускаются при массовой передаче данных — когда в выходном буфере остаётся более одной TLS-записи максимального размера (16 КБ). Небольшие ответы по-прежнему получают задержки для анти-фингерпринтинга. Это более реалистично, чем подход с задержкой на каждой записи (как в mtg): реальные HTTPS-серверы отдают объёмный контент на скорости TCP и варьируют тайминги только между отдельными ответами.

    Новая метрика: drs_delays_skipped / mtproxy_drs_delays_skipped_total.

    Обновите Docker-образ или пересоберите из исходников для применения исправления.

  3. P-D-A commented on Mar 27, 2026

    @P-D-A

    Hi

    TG is really struggling with the new feature.
    Clear the TG cache to play.

  4. dvershinin commented on Mar 27, 2026

    @dvershinin

    @P-D-A Have you tried with 3.5.1? That should fix it.

  5. P-D-A commented on Mar 27, 2026

    @P-D-A

    @dvershinin
    Yes, the problem is relevant on 3.5.1

    Temporarily reverted to version 3.4.0

  6. added 2 commits that reference this issue on Mar 27, 2026
    eb22417
    5ca1987
  7. dvershinin commented on Mar 27, 2026

    @dvershinin

    @P-D-A v3.5.2 further improves DRS delay handling.

    The v3.5.1 burst threshold wasn't sufficient — delays could still fire at batch boundaries during sustained downloads. Now delays only apply during slow-start phases (first ~60 records, ~140KB). Once the connection reaches max-size TLS records, all delays are skipped entirely. The counter resets after 1s of inactivity, so new responses still get realistic timing.

    Please update your Docker image and test again. Would appreciate your feedback.

  8. P-D-A commented on Mar 27, 2026

    @P-D-A

    @dvershinin

    Files send fine.
    Messages load satisfactorily.
    But there's a problem with icons and stickers.

    Image
    Image
    Image

    pid	1
    start_time	1774637884
    current_time	1774639269
    uptime	1385
    tot_idle_time	1380.738
    average_idle_percent	99.692
    recent_idle_percent	99.246
    active_network_events	0
    time_after_epoll	0.000269
    epoll_calls	698069
    epoll_intr	0
    PID	[172.18.20.6:8888:1:1774637884]
    >>>>>>connections>>>>>>	start
    active_connections	66
    active_dh_connections	0
    outbound_connections	64
    ready_outbound_connections	63
    active_outbound_connections	64
    outbound_connections_created	2827
    total_connect_failures	822
    inbound_connections	2
    active_inbound_connections	2
    inbound_connections_accepted	126
    listening_connections	1
    unused_connections_closed	0
    ready_targets	16
    allocated_targets	19
    active_targets	19
    inactive_targets	0
    free_targets	0
    max_connections	60000
    active_special_connections	0
    max_special_connections	60000
    max_accept_rate	0
    cur_accept_rate_remaining	0.000000
    max_connection	83
    conn_generation	2891
    allocated_connections	66
    allocated_outbound_connections	64
    allocated_inbound_connections	2
    allocated_socket_connections	66
    tcp_readv_calls	10656
    tcp_readv_intr	0
    tcp_readv_bytes	325629
    tcp_writev_calls	4331
    tcp_writev_intr	0
    tcp_writev_bytes	2341849
    free_later_size	0
    free_later_total	0
    accept_calls_failed	0
    accept_nonblock_set_failed	0
    accept_connection_limit_failed	0
    accept_rate_limit_failed	0
    accept_init_accepted_failed	0
    accept_ip_acl_rejected	0
    <<<<<<connections<<<<<<	end
    >>>>>>raw_msg>>>>>>	start
    rwm_total_msgs	388
    rwm_total_msg_parts	314
    <<<<<<raw_msg<<<<<<	end
    >>>>>>raw_msg_buffer>>>>>>	start
    total_used_buffers_size	610304
    total_used_buffers	442
    allocated_buffer_bytes	4194176
    buffer_chunk_alloc_ops	2
    allocated_buffer_chunks	2
    max_allocated_buffer_chunks	2
    max_buffer_chunks	128
    max_allocated_buffer_bytes	268435456
    <<<<<<raw_msg_buffer<<<<<<	end
    >>>>>>tl_parse>>>>>>	start
    rpc_queries_received	0
    rpc_answers_error	0
    rpc_answers_received	0
    rpc_sent_errors	0
    rpc_sent_answers	0
    rpc_sent_queries	0
    tl_in_allocated	0
    tl_out_allocated	0
    rpc_qps	0.000000
    default_rpc_flags	2056
    <<<<<<tl_parse<<<<<<	end
    >>>>>>crypto_aes>>>>>>	start
    allocated_aes_crypto	64
    allocated_aes_crypto_temp	0
    aes_pwd_hash	XXX
    <<<<<<crypto_aes<<<<<<	end
    >>>>>>crypto_dh>>>>>>	start
    tot_dh_rounds	0 0 0
    <<<<<<crypto_dh<<<<<<	end
    >>>>>>jobs>>>>>>	start
    thread_average_idle_percent	0.000 100.035 100.035 99.692  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_recent_idle_percent	0.000 100.000 100.000 99.246  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    tot_threads	0 16 8 1  0 0 0 0  0 0 0 0  0 0 0 0
    thread_load_average_user	0.000 0.000 0.000 0.898  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_load_average_sys	0.000 0.000 0.000 1.147  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_load_average	0.000 0.000 0.000 2.045  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_load_recent_user	0.000 0.000 0.000 0.900  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_load_recent_sys	0.000 0.000 0.000 1.400  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    thread_load_recent	0.000 0.000 0.000 2.300  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000  0.000 0.000 0.000 0.000
    load_average_user	0.898
    load_average_sys	1.147
    load_average_total	2.045
    load_recent_user	0.900
    load_recent_sys	1.400
    load_recent_total	2.300
    max_average_user	0.898
    max_average_sys	1.147
    max_average_total	2.045
    max_recent_user	0.900
    max_recent_sys	1.400
    max_recent_total	2.300
    job_timers_allocated	1
    jobs_created	5805
    jobs_active	157
    jobs_running	0 0 0 0  1 0 0 0  0 0 0 0  0 0 0 0
    jobs_allocated_memory	68328
    timer_ops	1789408
    timer_ops_scheduler	0
    <<<<<<jobs<<<<<<	end
    >>>>>>mp_queue>>>>>>	start
    mpq_blocks_allocated	0
    mpq_blocks_allocated_max	0
    mpq_blocks_allocations	8681
    mpq_blocks_true_allocations	8681
    mpq_blocks_wasted	0
    mpq_blocks_prepared	0
    mpq_small_blocks_allocated	209
    mpq_small_blocks_allocated_max	239
    mpq_active	205
    mpq_allocated	204
    <<<<<<mp_queue<<<<<<	end
    >>>>>>timers>>>>>>	start
    event_timer_insert_ops	895672
    event_timer_remove_ops	893736
    event_timer_alarms	893736
    total_timers	21
    <<<<<<timers<<<<<<	end
    >>>>>>rpc_targets>>>>>>	start
    total_rpc_targets	0
    total_connections_in_rpc_targets	0
    <<<<<<rpc_targets<<<<<<	end
    stats_generate_time	0.000191
    vmsize_bytes	264347648
    vmrss_bytes	7606272
    vmdata_bytes	258469888
    config_filename	data/proxy-multi.conf
    config_loaded_at	1774637884
    config_size	821
    config_md5	XXX
    config_auth_clusters	12
    workers	5
    queries_get	0
    qps_get	0.000
    tot_forwarded_queries	4080
    expired_forwarded_queries	0
    dropped_queries	0
    tot_forwarded_responses	3706
    dropped_responses	0
    tot_forwarded_simple_acks	163
    dropped_simple_acks	1
    active_rpcs_created	0
    active_rpcs	0
    rpc_dropped_answers	0
    rpc_dropped_running	0
    window_clamp	0
    total_ready_targets	80
    total_allocated_targets	95
    total_declared_targets	95
    total_inactive_targets	0
    total_connections	386
    total_encrypted_connections	384
    total_allocated_connections	394
    total_allocated_outbound_connections	392
    total_allocated_inbound_connections	2
    total_allocated_socket_connections	394
    total_dh_connections	0
    total_dh_rounds	0 0 0
    total_special_connections	0
    total_max_special_connections	300000
    total_accept_connections_failed	0 0 0 0 0
    accept_ip_acl_rejected	0
    ext_connections	0
    ext_connections_created	136
    total_active_network_events	0
    total_network_buffers_used_size	2458624
    total_network_buffers_allocated_bytes	31456320
    total_network_buffers_used	1916
    total_network_buffer_chunks_allocated	15
    total_network_buffer_chunks_allocated_max	15
    mtproto_proxy_errors	0
    connections_failed_lru	0
    connections_failed_flood	0
    http_connections	1
    pending_http_queries	0
    http_queries	336
    http_bad_headers	0
    http_qps	0.242599
    proxy_mode	2
    proxy_tag_set	0
    direct_mode	0
    direct_dc_connections_created	0
    direct_dc_connections_active	0
    direct_dc_connections_failed	0
    direct_dc_connections_dc_closed	0
    drs_delays_enabled	1
    drs_delays_applied	1092
    drs_delays_skipped	1201
    drs_weibull_k	0.378000
    drs_weibull_lambda	1.732000
    version	mtproxy-3.5.2 compiled at Mar 27 2026 18:40:17 by gcc 14.2.0 64-bit after commit 
    secret_secret_0_connections	-136
    secret_secret_0_connections_created	0
    secret_secret_0_rejected	0
    
  9. dvershinin commented on Mar 28, 2026

    @dvershinin

    @P-D-A Спасибо за отчёт со скриншотами и статистикой — это очень помогло найти причину.

    Нашли две ошибки:

    1. Стикеры и иконки не грузятся — межзаписные задержки DRS перезапускались после каждой 1-секундной паузы в трафике. Стикеры и аватарки — маленькие файлы, которые всегда попадали в окно slow-start (первые 60 записей), и каждый раз получали задержки заново. Теперь счётчик задержек сбрасывается только после 30 секунд простоя, а не после 1 секунды. Короткие паузы между загрузками стикеров больше не перезапускают задержки.

    2. secret_secret_0_connections: -136 — счётчик уходил в минус, потому что инкремент срабатывал при приёме соединения (до хэндшейка, когда секрет ещё не определён), а декремент — при закрытии (когда секрет уже известен). Перенесли инкремент на момент после успешного хэндшейка.

    Исправлено в v3.5.3. Обновите образ и проверьте, загружаются ли стикеры и иконки.

  10. kmurachev commented on Mar 28, 2026

    @kmurachev

    У меня на
    Invoking engine mtproxy-3.5.3 compiled at Mar 28 2026 10:46:27 by gcc 11.4.0 64-bit after commit a5f08fb
    потестил на десктопном и андроид клиентах,
    в обычном режиме (non --direct режиме) вроде как всё ок

    может кто ещё отпишется

    p.s.: не знаю, важно это, или нет, при компиляции идут ворнинги

    ...
    mtproto/mtproto-dc-table.c:33:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 1, 0, 443 },  /* 149.154.175.50  */
               ^~~
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
    mtproto/mtproto-dc-table.c:34:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 2, 0, 443 },  /* 149.154.167.51  */
               ^~~
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.51  */
               {   }
    mtproto/mtproto-dc-table.c:35:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 3, 0, 443 },  /* 149.154.175.100 */
               ^~~
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.51  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.100 */
               {   }
    mtproto/mtproto-dc-table.c:36:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 4, 0, 443 },  /* 149.154.167.91  */
               ^~~
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.51  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.100 */
               {   }
       { 4, 0, 443 },  /* 149.154.167.91  */
               {   }
    mtproto/mtproto-dc-table.c:37:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 5, 0, 443 },  /* 91.108.56.100   */
               ^~~
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.51  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.100 */
               {   }
       { 4, 0, 443 },  /* 149.154.167.91  */
               {   }
       { 5, 0, 443 },  /* 91.108.56.100   */
               {   }
    mtproto/mtproto-dc-table.c:32:51: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address production_dcs[] = {
                                                       ^
       { 1, 0, 443 },  /* 149.154.175.50  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.51  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.100 */
               {   }
       { 4, 0, 443 },  /* 149.154.167.91  */
               {   }
       { 5, 0, 443 },  /* 91.108.56.100   */
               {   }
    mtproto/mtproto-dc-table.c:41:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 1, 0, 443 },  /* 149.154.175.10  */
               ^~~
    mtproto/mtproto-dc-table.c:40:45: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address test_dcs[] = {
                                                 ^
       { 1, 0, 443 },  /* 149.154.175.10  */
               {   }
    mtproto/mtproto-dc-table.c:42:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 2, 0, 443 },  /* 149.154.167.40  */
               ^~~
    mtproto/mtproto-dc-table.c:40:45: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address test_dcs[] = {
                                                 ^
       { 1, 0, 443 },  /* 149.154.175.10  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.40  */
               {   }
    mtproto/mtproto-dc-table.c:43:11: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘443’ to ‘187’ [-Woverflow]
       { 3, 0, 443 },  /* 149.154.175.117 */
               ^~~
    mtproto/mtproto-dc-table.c:40:45: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address test_dcs[] = {
                                                 ^
       { 1, 0, 443 },  /* 149.154.175.10  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.40  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.117 */
               {   }
    mtproto/mtproto-dc-table.c:40:45: warning: missing braces around initializer [-Wmissing-braces]
     static const struct dc_address test_dcs[] = {
                                                 ^
       { 1, 0, 443 },  /* 149.154.175.10  */
               {   }
       { 2, 0, 443 },  /* 149.154.167.40  */
               {   }
       { 3, 0, 443 },  /* 149.154.175.117 */
               {   }
    ...
    

    раньше в логах было чисто

  11. kmurachev commented on Mar 28, 2026

    @kmurachev
  12. P-D-A commented on Mar 28, 2026

    @P-D-A

    @dvershinin

    Yes, everything looks good now.

    Thank you for your efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions