tempesta-tech / tempesta

All-in-one solution for high performance web content delivery and advanced protection against DDoS and web attacks
https://tempesta-tech.com/
GNU General Public License v2.0
613 stars 103 forks source link

BUG at /root/tempesta/tempesta_fw/http_sess.c:485 #626

Closed krizhanovsky closed 7 years ago

krizhanovsky commented 7 years ago

Steps to reproduce:

  1. deply tempesta-tech.com at Apache running in VM, the server must listen on 127.0.0.1:8080;
  2. deply Tempesta FW (current master) on the same VM with following configuration

    listen 172.16.0.5:80;
    server 127.0.0.1:8080;
    cache 1;
    cache_fulfill * *;
    sticky name=__TFW__ enforce;
    sticky_secret "f00)9eR59*_/22";
    sess_lifetime 90;
  3. send two requests, one by one, using:

    wget http://172.16.0.5/img/ico/favicon.png
  4. enjoy the crash:

    kernel BUG at /root/tempesta/tempesta_fw/http_sess.c:485!
    invalid opcode: 0000 [#1] SMP
    Modules linked in: tfw_sched_rr(O) tfw_sched_http(O) tfw_sched_hash(O) tempesta_fw(O) tempesta_db(O) tempesta_tls(PO) nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_CHECKSUM iptable_mangle bridge stp llc ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables crc32c_intel aesni_intel aes_x86_64 glue_helper xfs libcrc32c exportfs lrw gf128mul ablk_helper cryptd ppdev i2c_piix4 microcode i2c_core pcspkr serio_raw parport_pc parport acpi_cpufreq dm_mirror dm_region_hash dm_log dm_mod uinput btrfs xor raid6_pq ata_generic pata_acpi e1000 ata_piix floppy ipv6 autofs4
    CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: P           O    4.1.27+ #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-1.fc24 04/01/2014
    task: ffff88005c82a010 ti: ffff88005c88c000 task.ti: ffff88005c88c000
    RIP: 0010:[<ffffffffa060a8b3>]  [<ffffffffa060a8b3>] tfw_http_sess_resp_process+0x43/0x50 [tempesta_fw]
    RSP: 0018:ffff88005c88fbf0  EFLAGS: 00010246
    RAX: ffffffffa05eb820 RBX: ffff88005a81f020 RCX: 0000000000000000
    RDX: 0000000000000001 RSI: ffff8800376e2020 RDI: ffff88005a81f020
    RBP: ffff88005c88fc48 R08: 0000000000000000 R09: ffff8800000bfbc0
    R10: 0000000000000000 R11: 0000000000000050 R12: 0000000000000002
    R13: ffff880002290580 R14: ffff88006c405010 R15: ffff88006c405010
    FS:  0000000000000000(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f181bdc1018 CR3: 000000005b8b7000 CR4: 00000000003406f0
    Stack:
    ffffffffa05eaa4e 0000000000000f1c ffff88005c88fd48 0000000000000002
    ffff88004a519cf0 0000000000000a7b ffff88006c4051f0 0000000000000000
    ffff8800376e2020 ffff88005a81f020 ffff880002290580 ffff88005c88fc88
    Call Trace:
    [<ffffffffa05eaa4e>] ? tfw_http_adjust_resp+0x2e/0x230 [tempesta_fw]
    [<ffffffffa05eb84a>] tfw_http_req_cache_cb+0x2a/0x2c0 [tempesta_fw]
    [<ffffffffa05e4f98>] tfw_wq_tasklet+0x478/0xca0 [tempesta_fw]
    [<ffffffffa05eb820>] ? tfw_http_send_404+0x110/0x110 [tempesta_fw]
    [<ffffffff814aac70>] ? net_rx_action+0x140/0x330
    [<ffffffffa05eb820>] ? tfw_http_send_404+0x110/0x110 [tempesta_fw]
    [<ffffffff8105d4bd>] tasklet_action+0xad/0x100
    [<ffffffff8105d8dd>] __do_softirq+0xfd/0x2c0
    [<ffffffff8105dac1>] run_ksoftirqd+0x21/0x50
    [<ffffffff81079ae3>] smpboot_thread_fn+0x143/0x1b0
    [<ffffffff810799a0>] ? sort_range+0x30/0x30
    [<ffffffff810765c2>] kthread+0xd2/0xf0
    [<ffffffff810764f0>] ? kthread_create_on_node+0x170/0x170
    [<ffffffff8157db92>] ret_from_fork+0x42/0x70
krizhanovsky commented 7 years ago

Please also investigate why unit test for http_sess didn't catch the failure and fix the test if necessary.

vankoven commented 7 years ago

Issue itself was fixed by PR #627.

Concerning unit testing: error took place inside of main packet flow routine. We have no unit tests for checking it. And the packet flow should be checked by functional tests which are under development.