Code Monkey home page Code Monkey logo

generic-linked-in-driver's People

Contributors

hegedenes avatar squidfunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generic-linked-in-driver's Issues

Issues with DRIVER_NAME=test in rebar.config

By leaving DRIVER_NAME=test defined inside the project's rebar.config, you override the dependent project's DRIVER_NAME flag and the driver is built with DRIVER_NAME=test instead of the actual project's driver name!

Segfault when cleaning up

Using the latest version of this lib combined with a driver I am writing, I get a segfault during cleanup in gen_driver.c: 160.

This is the GDB dump

fdb_test: hello_world_test (module 'fdb_test')...[New Thread 0x7fffd770d700 (LWP 41859)]
/usr/local/lib/erlang/erts-5.10.3/bin/beam: 
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6f61d2a in strchrnul () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) backtrace 
#0  0x00007ffff6f61d2a in strchrnul () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6f17a60 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff6f1d1a4 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff6f17bde in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff6fc0ce5 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00007ffff6fc0e43 in error () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007fffd7dfb8d7 in ready (drv_data=0x7ffff66c15f8, thread_data=0x7ffff66c1a00) at deps/gen_driver/c_src/gen_driver.c:160
#7  0x000000000047c078 in async_ready (p=0x7ffff66c13b8, data=<optimized out>) at beam/io.c:4805
#8  0x00000000004d318a in call_async_ready (a=0x7ffff66c1768) at beam/erl_async.c:399
#9  erts_check_async_ready (varq=0x7ffff6531440) at beam/erl_async.c:549
#10 0x0000000000485968 in handle_async_ready (aux_work=64, awdp=<optimized out>, waiting=<optimized out>) at beam/erl_process.c:1247
#11 handle_aux_work (awdp=0x7ffff64c02c0, orig_aux_work=<optimized out>, waiting=<optimized out>) at beam/erl_process.c:1743
#12 0x0000000000489174 in scheduler_wait (rq=0x7ffff64c0080, esdp=0x7ffff64c0280, fcalls=<synthetic pointer>) at beam/erl_process.c:2435
#13 schedule (p=<optimized out>, calls=<optimized out>) at beam/erl_process.c:7017
#14 0x0000000000507adb in process_main () at beam/beam_emu.c:1198
#15 0x000000000044685f in erl_start (argc=26, argv=<optimized out>) at beam/erl_init.c:1783
#16 0x000000000042ab39 in main (argc=<optimized out>, argv=<optimized out>) at sys/unix/erl_main.c:29

c_src/gen_driver.c segfaults at line 160

Using the current commit of our fdb_driver the ready segfaults on the error in the last test on cluster_create_database.

void
ready(ErlDrvData drv_data, ErlDrvThreadData thread_data) {
  gd_t *drv     = (gd_t *)drv_data;
  gd_ptr_t *ptr = (gd_ptr_t *)thread_data;

  /* Check, if we reached the end of the request buffer */
  ei_decode_list_header(ptr->req->buf, &ptr->req->index, NULL);
  if (!error_occurred(ptr->res) && ptr->req->len != ptr->req->index)
    // THIS IS LINE 160 & IT SEGFAULTS
    error(ptr->res, GD_ERR_DEC);

  /* Check for error on synchronous request, output data */
  if (ptr->req->syn) {
    if (error_occurred(ptr->res) && (ptr->res->index = 1))
      encode_error(ptr->res->buf, &ptr->res->index, ptr->res->error);
    else if (ptr->res->index == 1)
      encode_ok(ptr->res->buf, &ptr->res->index);
    driver_output(drv->port, ptr->res->buf, ptr->res->index);
  }

  /* Free request and result */
  driver_free(ptr->req->buf); /* control */
  driver_free(ptr->res->buf); /* control */
  driver_free(ptr->req); /* control */
  driver_free(ptr->res); /* control */
  driver_free(ptr); /* control */
}

I assume this has to do with the size of the preallocated buffer; I'll try changing the size?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.