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

Segmentation Fault when processing yaml file #291

Open
Rwardc opened this issue Oct 17, 2023 · 1 comment
Open

Segmentation Fault when processing yaml file #291

Rwardc opened this issue Oct 17, 2023 · 1 comment

Comments

@Rwardc
Copy link

Rwardc commented Oct 17, 2023

When processing this yaml file (which may be malformed), a segfault is encountered in verifier_server.cc:

meta:
  version: '1.0'


sessions:
  - protocol: [ { name: tcp }, {name: ip} ]
    transactions:
    - client-request:
        method: GET
        url: http://127.0.0.1
        version: '1.1'
        headers:
        fields:
          - [ Host, 127.0.0.1:8080 ]
          - [ Connection, Keep-Alive ]
          - [ uuid, the-transaction ]
        content:
          size: 0
      uuid: first-transaction

  
    proxy-response:
      content:
        encoding: plain
        size: 0
      headers:
        fields:
        - [ Connection, keep-alive ]
      reason: OK
      status: 200

Segfault output from gdb:

(gdb) run run --listen-http 127.0.0.1:8080 /c/Code/git/verifier-tests/simple.yaml
Starting program: /mnt/c/Code/git/proxy-verifier/bin/verifier-server run --listen-http 127.0.0.1:8080 /c/Code/git/verifier-tests/simple.yaml
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
ServerReplayFileHandler::txn_close (this=0x7ffffffebf00) at local/src/server/verifier-server.cc:547
547             _txn_node->Mark().line);

Expected Behavior:
Even when processing a bad yaml file, an informative error should be printed instead.

@Rwardc
Copy link
Author

Rwardc commented Oct 17, 2023

Back trace for the previous segfault:

#0  ServerReplayFileHandler::txn_close (this=0x7ffffffebf00) at local/src/server/verifier-server.cc:547
#1  0x000000000049023d in YamlParser::load_replay_file (path=..., handler=...) at local/src/core/YamlParser.cc:1406
#2  0x00000000004212b7 in operator() (file=..., __closure=<optimized out>) at local/src/server/verifier-server.cc:975
#3  0x00000000004213cd in std::__invoke_impl<swoc::_1_5_1::Errata, Engine::command_run()::<lambda(const swoc::_1_5_1::file::path&)>&, const swoc::_1_5_1::file::path&> (__f=...) at /usr/local/include/c++/11.3.0/bits/invoke.h:61
#4  std::__invoke_r<swoc::_1_5_1::Errata, Engine::command_run()::<lambda(const swoc::_1_5_1::file::path&)>&, const swoc::_1_5_1::file::path&> (__fn=...) at /usr/local/include/c++/11.3.0/bits/invoke.h:116
#5  std::_Function_handler<swoc::_1_5_1::Errata(const swoc::_1_5_1::file::path&), Engine::command_run()::<lambda(const swoc::_1_5_1::file::path&)> >::_M_invoke(const std::_Any_data &, const swoc::_1_5_1::file::path &) (__functor=...,
    __args#0=...) at /usr/local/include/c++/11.3.0/bits/std_function.h:291
#6  0x0000000000490f38 in std::function<swoc::_1_5_1::Errata (swoc::_1_5_1::file::path const&)>::operator()(swoc::_1_5_1::file::path const&) const (__args#0=..., this=0x7ffffffecdf0) at /usr/local/include/c++/11.3.0/bits/std_function.h:590
#7  YamlParser::load_replay_files(swoc::_1_5_1::file::path const&, std::function<swoc::_1_5_1::Errata (swoc::_1_5_1::file::path const&)>, int) (path=..., loader=..., n_threads=n_threads@entry=10) at local/src/core/YamlParser.cc:1435
#8  0x0000000000424099 in Engine::command_run (this=<optimized out>)
    at /usr/local/include/c++/11.3.0/ext/new_allocator.h:89
#9  0x0000000000415308 in main (argv=<optimized out>) at local/src/server/verifier-server.cc:1167

This is due to a missing server-response in the file. According to the json schema, server-response is not a required field.

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

No branches or pull requests

1 participant