Commit Graph

  • e03d2b3ffe In gw_read_client_event, if ioctl returns non-zero and 'b' (number of readable bytes) is zero, that indicates that socket is closed. Thus, read is now skipped and dcb closed if it is in DSC_STATE_POLLING state. vraatikka 2013-09-27 14:57:53 +03:00
  • 1120ae9b2c Zombie processing had an risk of getting into an infinite loop. vraatikka 2013-09-27 11:20:28 +03:00
  • 46c5564313 Removed states MYSQL_WAITING_RESULT and MYSQL_ROUTING Massimiliano Pinto 2013-09-26 18:01:48 +02:00
  • ee7b799bf1 Bug 160 - fixed memory leaks with telnetd and debug CLI Mark Riddoch 2013-09-26 17:38:35 +02:00
  • 1e83308cd1 Bug 133 - cleanup data<pid> directory on SIGINT Mark Riddoch 2013-09-26 16:33:16 +02:00
  • ab731274fd Bug 218 - add error message if MAXSCALE_HOME does not exist Mark Riddoch 2013-09-26 13:46:04 +02:00
  • c26bd04ea7 Addition of messages to standard error if MaxScale refuses to start for some reason Mark Riddoch 2013-09-26 12:21:45 +02:00
  • c1c7a3fb02 Additional check for service starts Mark Riddoch 2013-09-26 10:38:31 +02:00
  • fe7d0477ba Improved configuration object checking Mark Riddoch 2013-09-26 10:37:55 +02:00
  • 947fc3509b Make configuration file reading more robust Mark Riddoch 2013-09-25 17:50:12 +02:00
  • 5d22884a9b Fixed NULL pointer issue Mark Riddoch 2013-09-25 16:36:54 +01:00
  • ed7c32fb88 Bug 124 - config file validation Mark Riddoch 2013-09-25 16:25:12 +01:00
  • 44d424adb4 setipaddress uses getaddrinfo Massimiliano Pinto 2013-09-25 11:08:39 +02:00
  • 3b647e47ab When there is no load but there are zombies to be cleaned up, it used to take at least nthreads*timeout time to get socket closed. Now in this case, once the timeout exceeds for the first time, all threads are allowed to call dcb_process_zombies without having to wait the timeout period until there are no zombies anymore. vraatikka 2013-09-25 09:12:18 +03:00
  • 20c4a60f01 Maxscale doesn't assert if tested with different errors in gw_MySQLAccept. vraatikka 2013-09-24 16:09:11 +03:00
  • 09cc20b7be Improved behavior of debug cli API command 'fail accept'. It takes now _two_ arguments, Syntax: vraatikka 2013-09-24 15:48:59 +03:00
  • e637ea3844 Merge vraatikka 2013-09-24 15:16:14 +03:00
  • 3e1322034d Added logging and som checks. vraatikka 2013-09-24 15:13:25 +03:00
  • a7c3cd5f30 Related to bug #217, added command 'fail accept <errno>' to debug client's commands. Reproduce #217 by connecting with telnet to debug client interface and execute command: vraatikka 2013-09-24 15:04:12 +03:00
  • d248ecb180 Added missing parameter in log write, poll_remove_dcb Massimiliano Pinto 2013-09-20 18:36:31 +02:00
  • eec0b74191 dcb_printf(pdcb, "\tQueued write data: %d\n", gwbuf_length(dcb->writeq)); is now protected by if (dcb->writeq) Massimiliano Pinto 2013-09-20 17:53:15 +02:00
  • 3b3d3dbfe0 Merge vraatikka 2013-09-20 15:05:19 +03:00
  • 302090a168 Removed unused local variable. vraatikka 2013-09-20 15:03:20 +03:00
  • 74aa3638f9 dcb.c dcb_final_free: Router session is not closed anymore when dcb is closed. Router session is shared among all dcbs and is closed and freed with session. dcb_connect: dcb's state must be switched fro DCB_STATE_ALLOC to DCB_STATE_DISCONNECTED before dcb_final_free can be called for it. dcb_close: poll_remove_dcb encapsulates dcb's state transition in the same way as poll_add_dcb. Removed state modification from dcb_close. Read return value of poll_remove_dcb and log accordingly. dcb_set state: remove dassert if dcb_set_state_nomutex returned false. False can be returned indicating that intented change didn't occur but the end state, for example, may be acceptable. Failures in state transitions are asserted in dcb_Set_state_nomutex. vraatikka 2013-09-20 14:32:28 +03:00
  • 85ac4d78dd HTTPD is now working: Massimiliano Pinto 2013-09-19 12:23:17 +02:00
  • c7b052aab3 Addition of CheckSessions debug entry point Mark Riddoch 2013-09-18 19:06:32 +02:00
  • ace4252832 Added closeSession to gw_error_backend_event: the backend failure is handled without faults Massimiliano Pinto 2013-09-18 11:50:19 +02:00
  • 4321861ed8 dcb_read : removed redundant or dead code. dcb_write: if fail backendfd | clientfd is used, now listener operations don't cause failure. vraatikka 2013-09-17 21:54:38 +03:00
  • 4cf5b3293f Added check routine for gw_buffer. Only effective in debug build. vraatikka 2013-09-17 15:10:16 +03:00
  • 5fba84a4ee poll.c : forgot from previous commit debugcmd.c : cannot compile. vraatikka 2013-09-17 00:16:06 +03:00
  • 8bf73ea154 Replaced write system function with wrapper gw_write. It allows for generating failures by using telnet commands, fail backendfd, fail clientfd, which are available in debug build only. vraatikka 2013-09-17 00:07:56 +03:00
  • db7004e6ae dcb's fd wasn't stored to client's protocol structure. Changed mysql_protocol_init to take fd as the Second argument. vraatikka 2013-09-14 23:01:26 +03:00
  • 4815856017 session.c : session_alloc If backend connection can't be created, backend_dcb is not create, router client session is not created and what already is created in session_alloc, is freed. mysql_client.c : gw_read_client_event If session creation failed, then - instead of sending ok to client, "failed to create new session" is sent and client dcb is closed. : gw_MySQLAccept removed loop where accept was called again and again. With single thread looping forever is not possible because there's no one to free previously allocated resources. If accept fails ten times in a row, then return without new client dcb. vraatikka 2013-09-13 23:55:26 +03:00
  • 710fc5cfa6 dcb.c : dcb_alloc switched malloc to calloc, dcb->fd is initialized to -1. : dcb_process_zombies return value of close(fd) is checked. Closed fds are stored to conn_open array. : dcb_connect assigns new fd only if backend connection succeeds. Dcb is added to poll set in the same way, only if connect succeed. gateway.c : conn_open array is initialized in main. For each created socket, a true is set to corresponding slot. Max. number of slots is 1024. mysql_client_server_protocol.h : gw_do_connect_to declaration mysql_backend.c : gw_create_backend_connection returns rv >= 0 and a protocol which is assigned to backend_dcb. In error, -1 is returned and fd is not set. mysql_client.c : conn_open array is kept up-to-date and protocol pointer is assigned also to dcb outside mysql_protocol_init. mysql_common.c : gw_do_connect_to_backend 3rd argument is pointer to fd, not protocol. dcb is added to poll set later in dcb_connect. skygw_debug.h : define conn_open[1024] array where open connections can be marked in debug build. vraatikka 2013-09-13 22:10:40 +03:00
  • c3fba63b45 Added break in routeQuery switch, avoiding the execution of default. Massimiliano Pinto 2013-09-13 19:17:20 +02:00
  • b2b715fcae Fixed failed handshake handling, taking care of dcb->delayq before sending reply one time and not twice. Massimiliano Pinto 2013-09-13 18:22:24 +02:00
  • 88174865a0 If accept fails due too many open fails, now ENFILE (system level file limit exceeded) and EMFILE (process limit) are separated and logged diffenretly. vraatikka 2013-09-13 10:10:02 +03:00
  • ae12ef8f34 Added call to close(fp_tmp) vraatikka 2013-09-12 23:13:22 +03:00
  • d7e793a411 poll.c:Returned checks for zombie mysql_backend.c:don't write to session->client if session->client is NULL mysql_common.c:assert if called with dcb==NULL vraatikka 2013-09-12 22:34:49 +03:00
  • bbc9dcc9a3 poll.c: added maxscale thread id to log session.c: Replaced free(session->router_sesision) with call to freeSession callback users.c: Removed reference to uninitialized variable. router.h: Added freeSession callback to function block. mysql_backend.c: try to ensure that client dcb is still listening in epoll_wait when writing reply to it. mysql_common.c: assert debug build is mysql_protocol_init is called with dcb == NULL readconnroute.c, readwritesplit.c, debugcli.c and testroute.c : Added freeSession to function block and an inmplementation of it. vraatikka 2013-09-12 22:17:11 +03:00
  • c4d01cdaed Backend sets session's client pointer to NULL before session_free is called for session. vraatikka 2013-09-12 22:10:43 +03:00
  • 15adf134c4 Defined LOGFILE_DEBUG for future use. If there will be separate logfile for debug output then macro will be removed. Currently equals with LOGFILE_TRACE. vraatikka 2013-09-12 22:01:05 +03:00
  • 3841f95531 In error cases, called close(fp). vraatikka 2013-09-12 22:00:08 +03:00
  • 775b318889 Added constants to gw_decode_mysql_server_handshake Massimiliano Pinto 2013-09-12 16:08:31 +02:00
  • 33fc1737d5 One uninitialized read in dcb_set_state_nomutex. One read of freed memory in dcb_process_zombies. The former may have affected on the program behavior. The latter left in many cases fds open and dcbs not freed for real. vraatikka 2013-09-12 10:00:55 +03:00
  • 092795d95b in dcb_final_free the dcb->session NULL check protects the access to dcb->session->router_session and all the code below Massimiliano Pinto 2013-09-10 15:50:47 +02:00
  • 22e9fb9a4d Bug 194: Crash starting listener if protocol module load fails Mark Riddoch 2013-09-09 16:33:04 +02:00
  • 6813f760a5 Fix for bug #205 - http://bugs.skysql.com/show_bug.cgi?id=205 . In gw_read_backend_event, read client_protocol by using dcb->session->client pointer but only after it is sure that there is something to write to client. This doesn't ensure that client pointer in session is valid, but it should be. vraatikka 2013-09-09 15:00:37 +03:00
  • 83a7479236 Removed free(router_session) from closeSession. Router session is free in session.c:session_free. vraatikka 2013-09-09 14:51:15 +03:00
  • 46464d7723 Check if router_session pointer has value in session structure before calling free for it. vraatikka 2013-09-09 14:36:45 +03:00
  • e1d7a5640d Put structure check fields behind SS_DEBUG macros. Thus, they are only included in debug builds. vraatikka 2013-09-09 10:05:46 +03:00
  • 27338c2537 Merge vraatikka 2013-09-09 00:05:28 +03:00
  • 189fdf35b8 Major changes: Removed NULL-pointer assignment after the call of backend_dcb->func.close because backend_dcb->func.close calls gw_client_close which _always_ returns true. Thus, its return value can't be used for deciding whether backend_dcb pointer can be set to NULL. There are typically multiple threads executing backend dcb. Setting NULL here will cause next caller to refer to NULL pointer, which makes maxscale to fail. vraatikka 2013-09-08 23:59:00 +03:00
  • d2a61c3f82 Added some checks and renamed according to changes made in elsewhere. vraatikka 2013-09-08 23:38:38 +03:00
  • e7e44667c3 Added some checks for return values. vraatikka 2013-09-08 23:37:34 +03:00
  • a13396bc66 Renamed struct CLIENT_SESSION to ROUTER_CLIENT_SESSION as it is router related thing. Client session refers more to SESSION. 'dcb' to 'backend_dcb' because it is more accurate. 'client_session' to 'router_client_session'. vraatikka 2013-09-08 23:32:53 +03:00
  • d535346987 Removed dead code. vraatikka 2013-09-08 23:32:13 +03:00
  • e40aace963 Renamed MySQLProtocol member 'descriptor' to 'owner_dcb'. vraatikka 2013-09-08 23:31:05 +03:00
  • 4c00cdac5e Cleaned up. Removed unnecessary extern keywords from function declarations so to fit them better to one line. vraatikka 2013-09-08 23:29:50 +03:00
  • e61c19c6fe Major change. router_session is freed as a last operation before freeing session. Fixes frequently occurring failures when multiple threads are running. vraatikka 2013-09-08 23:27:57 +03:00
  • 6a07ef8245 Added debug logging to poll_remove_dcb. Removed dead code from poll_waitevents. vraatikka 2013-09-08 23:26:15 +03:00
  • 03fed73b64 Added missing spinlock_release to dcb_add_to_zombieslist to avoid deadlock. vraatikka 2013-09-08 23:24:54 +03:00
  • 0d47aa2d3a Remove some contention on the DCB zombie queue spinlock Mark Riddoch 2013-09-05 22:05:55 +02:00
  • 66e9be814b dcb.h ------- Removed DCB states DCB_STATE_IDLE, and DCB_STATE_PROCESSING. Added DCB_STATE_UNDEFINED for initial content for state variable which doesn't have any specific value set, and DCB_STATE_NOPOLLING to indicate that dcb has been removed from poll set. vraatikka 2013-09-05 22:00:02 +03:00
  • 17ec98fa3d session was assigned state SESSION_STATE_READY outside protected block, and backend dcb thread saw authentication data and session in SESSION_STATE_ALLOC state, which trapped. Moved state assignment inside protection block. vraatikka 2013-09-05 19:47:42 +03:00
  • 4f8057034a Protected temporarily with spinlock gethostbyname which is not thread safe. This should be changed permanently so that gethostbyname is replaced with getaddrinfo. vraatikka 2013-09-05 19:42:59 +03:00
  • 8f98ae4751 Removed old mysql protocol files Massimiliano Pinto 2013-09-04 15:53:51 +02:00
  • 6888735f7b Removed old gateway_mysql_protocol.c server/core/Makefile updtated Massimiliano Pinto 2013-09-04 15:41:08 +02:00
  • b01cf2365e Added log error or ss_dassert instead of silent returning Massimiliano Pinto 2013-09-04 15:31:04 +02:00
  • 5c48239372 Fixed doxygen documentation generation Mark Riddoch 2013-09-04 13:13:54 +02:00
  • f74f67540f Added spinlock protection for the session association to the DCB and reworked the reference count mechanism on the session. Introduced a FREE state for the session and alter the session destruction flow so that we only remove the session when all the DCB's have singled they have finished processing events for the DCB rather than when the first thread decides to clsoe the DCB. Mark Riddoch 2013-09-04 12:24:59 +02:00
  • 8debc4433c Added a client NULL check in clientReply Massimiliano Pinto 2013-09-04 11:37:56 +02:00
  • be27d36f8c Added dcb NULL check in mysql_send_custom_error() Massimiliano Pinto 2013-09-04 11:26:14 +02:00
  • 61df7eb07d Added checks against NULL in gw_read_backend_event for dcb->session and dcb->session->client Massimiliano Pinto 2013-09-04 10:57:08 +02:00
  • db164be946 Added spinlock protection for refcount increase in dcb_connect Massimiliano Pinto 2013-09-04 10:00:40 +02:00
  • 8e97974216 Fixed return rc after: Massimiliano Pinto 2013-09-03 14:42:47 +02:00
  • a605b8fd9b Removed unused macros. vraatikka 2013-09-02 22:21:28 +03:00
  • 3d5c40e450 Removed unused macros. Fixed struct member order so that check field is again the last in struct and it detects memory overflows slightly better. vraatikka 2013-09-02 21:54:24 +03:00
  • 366441a4bb Added debug assert for checking return value of memory allocation. vraatikka 2013-09-02 21:53:49 +03:00
  • c4ce2efd9f Added debug assert for DCB states prior processing. vraatikka 2013-09-02 21:52:57 +03:00
  • 5487f84532 Added logging to session refcount increment. Some minor improvements. vraatikka 2013-09-02 21:52:09 +03:00
  • f80bb51db1 dcb_close sets some session fields to NULL: Massimiliano Pinto 2013-09-02 19:33:55 +02:00
  • 31cda5ad65 Added session refcount in session.h Massimiliano Pinto 2013-09-02 10:26:34 +02:00
  • b86d3f3dfd Holding error log's block buffer registration until all logs were written caused deadlock if block buffers were full. Now buffer registrations don't overlap. vraatikka 2013-09-02 10:30:50 +03:00
  • ce0085a078 Clean up. vraatikka 2013-09-01 00:37:49 +03:00
  • 757a043386 Replaced oinlined protocol creation with call to mysql_protocol_init. Clean up. vraatikka 2013-09-01 00:36:31 +03:00
  • 9df2040a8a Removed unused variables, changed call to mysql_protocol_init to reflect new prototype. vraatikka 2013-09-01 00:32:57 +03:00
  • 88ffcaa3d4 Removed 'extern' keyword from function declaration in headers. Functions are 'extern' by default. Changed mysql_protocol_init prototype and implementation to return MySQLProtocol pointer instead of boolean. vraatikka 2013-09-01 00:30:46 +03:00
  • 9bf0f58526 introduce mysql_protocol_init. vraatikka 2013-08-31 23:54:35 +03:00
  • 3dff91e80f In gw_create_backend_connection, replaced inlined protocol init with call to mysql_protocol_init (mysql_common.c). Replaced fprintfs with logging commands. vraatikka 2013-08-31 23:51:54 +03:00
  • c23168ed71 gw_do_connect_to_backend returned zero in case where connect failed with errno EINPROGRESS. Should have returned 1 to indicate that connection will be established asynchronously. vraatikka 2013-08-31 23:45:40 +03:00
  • 9d6b13c288 Replaced macros with enumereted type. vraatikka 2013-08-31 12:04:02 +03:00
  • a445b6ff37 Fixes for NULL test for function returns such as malloc() - as reported by Coverity Mark Riddoch 2013-08-29 13:34:21 +02:00
  • 03725cabe3 Fixed compile issue in dcb.h Mark Riddoch 2013-08-29 13:17:19 +02:00
  • 94a8ad68d3 Checked for bug #178. Added error logs to suitabl places. vraatikka 2013-08-29 09:50:16 +03:00
  • 527df6c7f3 Merge, mostly. vraatikka 2013-08-28 23:26:09 +03:00
  • 48165bf5cd Removed unused protocol_mutex and references to it. vraatikka 2013-08-28 23:25:27 +03:00
  • 134c33776e Added consistency check fields, and switched macros to enumerated types. vraatikka 2013-08-28 23:23:05 +03:00
  • 50a3cfdf49 Commented out some dead code. vraatikka 2013-08-28 23:17:18 +03:00
  • ae9fce8591 Added write and read lock to DCB to protect concurrent threads fro executing EPOLLIN and EPOLLOUT events on same descriptor, respectively. Added consistency checks and trace logging. vraatikka 2013-08-28 23:09:37 +03:00