| Bug #40498 | MGM C API calls "Exit" if connection to the managment server is lost | ||
|---|---|---|---|
| Submitted: | 4 Nov 2008 12:51 | Modified: | 19 Nov 2008 14:36 |
| Reporter: | Lars Torstensson | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S2 (Serious) |
| Version: | ndb-6.3.17-telco | OS: | Linux |
| Assigned to: | Magnus Blåudd | CPU Architecture: | Any |
| Tags: | MGM C API Exit | ||
[12 Nov 2008 14:13]
Magnus Blåudd
The application get "broken pipe" error. This can be caught by installing a signal handler that ignores this error, the default signal handler will call "exit" without any error message. #include <signal.h> signal(SIGPIPE, SIG_IGN); We need to decide _if_ we should install a signal handler for SIGPIPE as part of mgmapi or if that would be up to the application to do.
[12 Nov 2008 14:27]
Jonas Oreland
brilliant analysis magnus! i think we *should* add the signal handler, e.g we do so in ndbapi R1 E1
[19 Nov 2008 9:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/59170 2744 Magnus Svensson 2008-11-19 Bug#40498 MGM C API calls "Exit" if connection to the managment server is lost - Install SIGPIPE handler to catch broken pipe error that occurs when writing to a closed or rest socket - Add function 'ndb_mgm_set_ignore_sigpipe' making it possible to avoid that mgmapi installs SIGPIPE handler
[19 Nov 2008 10:36]
Bugs System
Pushed into 5.1.29-ndb-6.3.19 (revid:msvensson@mysql.com-20081119095201-y1z9a2q9l7w8fr0e) (version source revid:msvensson@mysql.com-20081119103154-liyfrlze453wheq1) (pib:5)
[19 Nov 2008 10:36]
Bugs System
Pushed into 5.1.29-ndb-6.4.0 (revid:msvensson@mysql.com-20081119095201-y1z9a2q9l7w8fr0e) (version source revid:msvensson@mysql.com-20081119103401-eeyjgl030jnt9yq3) (pib:5)
[19 Nov 2008 14:36]
Jon Stephens
Documented bugfix in the NDB-6.3.19 changelog as follows:
MGM API applications exited without raising any errors if the
connection to the management server was lost. The fix for this
issue includes two changes:
1. The MGM API now provides its own SIGPIPE
handler to catch the broken pipe error that occurs
when writing to a closed or reset socket. This means that
MGM API now behaves the same as NDB API in this regard.
2. A new function ndb_mgm_set_ignore_sigpipe() has
been added to the MGM API. This function makes it possible
to bypass the SIGPIPE handler provded by the MGM API.
Documented new function in the Cluster API Guide: http://lists.mysql.com/commits/59235

Description: ndb_mgm_get_status() in the MGM C API calls "Exit" if a the connected mgm server is shutdown. Should return an error code instead. How to repeat: 1 Start a mgm server. 2 Connect this program below to the mgm server. 3 stop the mgm server and the program will exit without an error NdbMgmHandle handle= ndb_mgm_create_handle(); ndb_mgm_connect(handle,0,0,0); while(1==1){ struct ndb_mgm_cluster_state *state= ndb_mgm_get_status(handle); if(state==NULL){ printf("This not connected part is never reached. Inte bra\n"); } for(int i=0; i < state->no_of_nodes; i++) { struct ndb_mgm_node_state *node_state= &state->node_states[i]; printf("node with ID=%d ", node_state->node_id); if(node_state->version != 0) printf("connected\n"); else printf("not connected\n"); } free((void*)state); sleep(1); } ndb_mgm_destroy_handle(&handle);