Segmentation fault with UDT file descriptors
When Gush is first started, segmentation fault appears. Here is the backtrace of the stack.
From the following line in TCPConnection::listen
loop->setHandlers(sock, _accept_handler, NULL, _accept_handler, true, false);
the program jumps to line #166 in event_loop_select.cc:
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | void SelectEventLoop::setHandlers(int fd, ReadHandler *rh, WriteHandler *wh, ErrorHandler *eh, bool reading, bool writing) { debugn(6, "setHandlers(" << fd << ", rh=" << (void *)rh << ", wh=" << (void *)wh << ", eh=" << (void *)eh << ", r=" << reading << ", w=" << writing << ")" ); gush_assert( fd >= 0, "fd < 0 in setHandlers()"); const unsigned int ufd = fd; MutexHolder lock_it(_lock); if (_read_handlers.size() <= ufd) { _read_handlers.resize(fd+1); } if (_write_handlers.size() <= ufd) { _write_handlers.resize(fd+1); } if (_error_handlers.size() <= ufd) { _error_handlers.resize(fd+1); } _read_handlers[fd] = rh; if ( reading ) { FD_SET( fd, &_read_fds ); } else { FD_CLR( fd, &_read_fds ); } _write_handlers[fd] = wh; if ( writing ) { FD_SET( fd, &_write_fds ); } else { FD_CLR( fd, &_write_fds ); } _error_handlers[fd] = eh; if ( eh != NULL ) { FD_SET( fd, &_error_fds ); } else { FD_CLR( fd, &_error_fds ); } updateMaxFD( fd ); } |
Turns out that I need to change all FD_??? macros into UDT4’s very own UD_??? ones.