squidfunk / generic-linked-in-driver Goto Github PK
View Code? Open in Web Editor NEWA generic non-blocking linked-in driver for interfacing Erlang and C
License: MIT License
A generic non-blocking linked-in driver for interfacing Erlang and C
License: MIT License
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!
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
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.