Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsquic_mini_conn_ietf_new 503 line core #211

Closed
lantiaoxian opened this issue Jan 6, 2021 · 9 comments
Closed

lsquic_mini_conn_ietf_new 503 line core #211

lantiaoxian opened this issue Jan 6, 2021 · 9 comments
Labels

Comments

@lantiaoxian
Copy link

hello, dear friend

I put http_server.c prog.c test_cert.c test_common.c in my program , and call liblsquic.so to run http_server.c . The server program will crash. Is there a pointer problem with the callback function?

thanks

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000003 in ?? ()
(gdb) bt
#0 0x0000000000000003 in ?? ()
#1 0x00007f32f96a1d14 in lsquic_mini_conn_ietf_new (enpub=0x55e31f184450, packet_in=0x55e31f1ac080, version=LSQVER_ID32, is_ipv4=1, odcid=0x0,
udp_payload_size=1200) at /usr/local/bigtree/bigtree_luquic_boringssl_lib/lsquic/src/liblsquic/lsquic_mini_conn_ietf.c:503
#2 0x00007f32f9642bd1 in find_or_create_conn (engine=0x55e31f184450, packet_in=0x55e31f1ac080, ppstate=0x7ffe24634e80, sa_local=0x55e31f1bd760,
sa_peer=0x55e31f1c24f0, peer_ctx=0x55e31f16f080, packet_in_size=1200)
at /usr/local/bigtree/bigtree_luquic_boringssl_lib/lsquic/src/liblsquic/lsquic_engine.c:1357
#3 0x00007f32f96431f2 in process_packet_in (engine=0x55e31f184450, packet_in=0x55e31f1ac080, ppstate=0x7ffe24634e80, sa_local=0x55e31f1bd760,
sa_peer=0x55e31f1c24f0, peer_ctx=0x55e31f16f080, packet_in_size=1200)
at /usr/local/bigtree/bigtree_luquic_boringssl_lib/lsquic/src/liblsquic/lsquic_engine.c:1484
#4 0x00007f32f9648dd0 in lsquic_engine_packet_in (engine=0x55e31f184450, packet_in_data=0x7f32fa5a04c0 "", packet_in_size=1200, sa_local=0x55e31f1bd760,
sa_peer=0x55e31f1c24f0, peer_ctx=0x55e31f16f080, ecn=0) at /usr/local/bigtree/bigtree_luquic_boringssl_lib/lsquic/src/liblsquic/lsquic_engine.c:3053
#5 0x000055e31de82e7e in read_handler (fd=6, flags=2, ctx=0x55e31f16f080) at test_common.cpp:750
#6 0x00007f32fa1b5f88 in event_persist_closure (ev=, base=0x55e31f183fe0) at event.c:1623
#7 event_process_active_single_queue (base=base@entry=0x55e31f183fe0, activeq=0x55e31f184430, max_to_process=max_to_process@entry=2147483647,
endtime=endtime@entry=0x0) at event.c:1682
#8 0x00007f32fa1b68ef in event_process_active (base=0x55e31f183fe0) at event.c:1783
#9 event_base_loop (base=0x55e31f183fe0, flags=0) at event.c:2006
#10 0x000055e31de86490 in prog_run (prog=0x7ffe246351d0) at prog.cpp:557
#11 0x000055e31de80652 in main (argc=10, argv=0x7ffe24635718) at main.cpp:2019
(gdb) f 1
#1 0x00007f32f96a1d14 in lsquic_mini_conn_ietf_new (enpub=0x55e31f184450, packet_in=0x55e31f1ac080, version=LSQVER_ID32, is_ipv4=1, odcid=0x0,
udp_payload_size=1200) at /usr/local/bigtree/bigtree_luquic_boringssl_lib/lsquic/src/liblsquic/lsquic_mini_conn_ietf.c:503
warning: Source file is more recent than executable.
503 enpub->enp_generate_scid(&conn->imc_conn,

@dtikhonov
Copy link
Contributor

What is enpub->enp_generate_scid set to? Did you set a custom SCID generation function in engine settings (ea_generate_scid)?

@lantiaoxian
Copy link
Author

I didn't set it, and I don't see set it in the example. Do you need to set it?

@dtikhonov
Copy link
Contributor

The reason I am asking is that I am trying to understand where the crash occurs based on the backtrace you pasted.

Could you perhaps compile your program with clang's AddressSanitizer or run it under valgrind?

@lolsalat
Copy link

lolsalat commented Jan 7, 2021

Hi.

I had a similar issue when using the library as shared library.
The reason is there is some
#ifdef in the lsquic.h inside some struct around a value.
This causes the struct to differ from the expected one (in the so, the field is present, in your newly compiled binary it is not)
This is why the callback for ea_generate_scid is set to some number instead of a function pointer.
I can look up the details later, hope this helps
Cheers

(I suggest removing the #ifdef completely, as it only causes the struct to be like 8 bytes bigger (I don't remember the actual datatype from the top of my head))

@dtikhonov
Copy link
Contributor

Thanks a lot for the tip, @lolsalat! It must be this code:

#if LSQUIC_CONN_STATS
    /**
     * If set, engine will print cumulative connection statistics to this
     * file just before it is destroyed.
     */
    void /* FILE, really */             *ea_stats_fh;
#endif

We will investigate.

@lantiaoxian
Copy link
Author

@lolsalat hello, How did you solve this problem?
@dtikhonov hello, What is the solution? thank you

@lolsalat
Copy link

lolsalat commented Jan 8, 2021

replacing

#if LSQUIC_CONN_STATS
    /**
     * If set, engine will print cumulative connection statistics to this
     * file just before it is destroyed.
     */
    void /* FILE, really */             *ea_stats_fh;
#endif

with

/**
 * If set, engine will print cumulative connection statistics to this
 * file just before it is destroyed.
 */
void /* FILE, really */             *ea_stats_fh;

in lsquic.h did the trick for me
(However, this might be seen as a hacky solution)

@lantiaoxian
Copy link
Author

@lolsalat ,ok,Thank you very much.

litespeedtech pushed a commit that referenced this issue Jan 8, 2021
- [BUGFIX] gQUIC: do not destroy critical streams when connection is
  closed.  See issue #201.
- [BUGFIX] Drop #if LSQUIC_CONN_STATS from lsquic.h.  See issue #211.
- [BUGFIX] Challenge cancellation when path validation fails.
- [BUGFIX] Do not send FIN if RST is scheduled to be sent on a stream.
- [BUGFIX] gQUIC's is_tickable() when connection is closing.
- [BUGFIX] Q050 processing of GOAWAY frames.
@litespeedtech
Copy link
Owner

Fixed in 2.27.3 -- closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants