Summary: | ASTERISK-12435: [patch] Update func_dialgroup to store in astdb | ||
Reporter: | Tilghman Lesher (tilghman) | Labels: | |
Date Opened: | 2008-07-23 10:40:13 | Date Closed: | 2008-08-06 11:50:22 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_dialgroup |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20080723__bug13138__2.diff.txt ( 1) 20080723__bug13138__3.diff.txt ( 2) 20080723__bug13138.diff.txt ( 3) 20080723__dialgroup_in_astdb.diff.txt ( 4) 20080725__bug13138.diff.txt | |
Description: | As suggested on the -dev list, upgrade func_dialgroup to store its data in the astdb, such that the data will be available across a restart. | ||
Comments: | By: Mark Michelson (mmichelson) 2008-07-23 12:16:25 I think the logic used in dialgroup_refreshdb is off. dialgroup_read has built-in logic to not copy any partial entries to the buffer. This means that it is possible that for a dialgroup with many entries, the entire list may not be copied into the buffer, but strlen(buffer) will be less than len - 1. This could lead to incomplete information being passed to ast_db_put. By: Tilghman Lesher (tilghman) 2008-07-23 12:25:50 Quite right. Let's try this, instead. By: Mark Michelson (mmichelson) 2008-07-23 12:38:26 Better, but now any time that the DIALGROUP's read callback is called and only part of the list can be copied to the buffer, the return value will be non-zero, which according to the doxygen documentation for ast_func_read means that a failure has occurred. To be honest, I don't know what sort of effect that will have on pbx execution, though. By: pj (pj) 2008-07-23 13:10:42 sad to say, 20080723__bug13138.diff.txt causes repeated crash:( [Jul 23 20:12:13] func_db.so => (Database (astdb) related dialplan functions) [Jul 23 20:12:13] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:588 __ast_pthread_mutex_lock: astobj2.c line 153 (ao2_lock): Error obtaining mutex: Invalid argument [Jul 23 20:12:13] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:692 __ast_pthread_mutex_unlock: astobj2.c line 167 (ao2_unlock): mutex '&p->priv_data.lock' freed more times than we've locked! [Jul 23 20:12:13] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:720 __ast_pthread_mutex_unlock: astobj2.c line 167 (ao2_unlock): Error releasing mutex: Invalid argument [Jul 23 20:12:14] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:588 __ast_pthread_mutex_lock: astobj2.c line 153 (ao2_lock): Error obtaining mutex: Invalid argument [Jul 23 20:12:14] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:692 __ast_pthread_mutex_unlock: astobj2.c line 167 (ao2_unlock): mutex '&p->priv_data.lock' freed more times than we've locked! [Jul 23 20:12:14] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:720 __ast_pthread_mutex_unlock: astobj2.c line 167 (ao2_unlock): Error releasing mutex: Invalid argument [Jul 23 20:12:14] ERROR[5587]: /root/src/asterisk-r132825/include/asterisk/lock.h:588 __ast_pthread_mutex_lock: astobj2.c line 153 (ao2_lock): Error obtaining mutex: Invalid argument [Jul 23 20:12:14] ERROR[5587]: astobj2.c:116 INTERNAL_OBJ: bad magic number 0x0 for 0x82fbb68 By: Tilghman Lesher (tilghman) 2008-07-23 13:32:53 putnopvut: actually, it will only return 1 if cmd is blank, which is only the case if called from within this module. pj: what platform are you on? I can't reproduce that error on load. By: pj (pj) 2008-07-23 14:05:02 I have intel processor, I tried your 20080723__bug13138__2.diff.txt with SVN-trunk-r132823, make clean, make install, it start crashing again after func_db.so was loaded. By: Tilghman Lesher (tilghman) 2008-07-23 14:26:31 pj: are you running something other than Linux? By: pj (pj) 2008-07-23 14:36:10 Linux 2.6.22-5mdv #1 SMP Fri Aug 10 16:44:23 CEST 2007 i686 Mobile Pentium II GNU/Linux By: Eliel Sardanons (eliel) 2008-07-23 14:41:50 The problem is while writing to the database (ast_db_put), in dialgroup_refreshdb, I think buf is being corrupted in dialgroup_read. By: pj (pj) 2008-07-23 14:49:40 It seems, that crashes begin after first call/write to db. After that, something currupted was writen into astdb and from that time asterisk start crashing repeatedly. If I look into astdb, something is wrong here, see... /dialgroup//dialgroup//dialgroup//dialgroup//dialgroup//dialgroup//dialgroup/324: ???????? /dialgroup//dialgroup//dialgroup//dialgroup//dialgroup//dialgroup/324: ???????? /dialgroup//dialgroup//dialgroup//dialgroup//dialgroup/324: ?????? /dialgroup//dialgroup//dialgroup//dialgroup/324 : ?????? /dialgroup//dialgroup//dialgroup/324 : ?3?3?8l8l /dialgroup//dialgroup/324 : ?????? /dialgroup/324 : ?????? By: Eliel Sardanons (eliel) 2008-07-23 14:52:11 cdialgroup=family/key and I think it should be only 'key'.... By: Tilghman Lesher (tilghman) 2008-07-23 15:58:01 pj: please 'database deltree dialgroup' and try this new patch. By: pj (pj) 2008-07-24 15:34:40 SVN-trunk-r133448M + 20080723__bug13138__3.diff.txt dialgroup content is now correctly writen/read into/from astdb :-) one issue persist: if I clear diagroup content using: Set(DIALGROUP(900)=); it's not cleared from astdb, in db is still previous content cli output (clear dialgoup content): Set("Skinny/324@PJ-4", "DIALGROUP(900)=") in new stack display, that dialgroup is really empty: NoOp("Skinny/324@PJ-4", "dgcontent:") in new stack database show: /dialgroup/900 : SIP/324&SIP/324 By: Tilghman Lesher (tilghman) 2008-07-25 09:11:17 Patch updated. Let me know if this one works better. By: pj (pj) 2008-07-25 10:49:41 It seems, that func_dialgroup is working fine now, ready for commit, thanks! By: Digium Subversion (svnbot) 2008-08-06 11:50:20 Repository: asterisk Revision: 136112 U trunk/funcs/func_dialgroup.c ------------------------------------------------------------------------ r136112 | tilghman | 2008-08-06 11:50:19 -0500 (Wed, 06 Aug 2008) | 7 lines Persist DIALGROUP() values in astdb (closes issue ASTERISK-12435) Reported by: Corydon76 Patches: 20080725__bug13138.diff.txt uploaded by Corydon76 (license 14) Tested by: pj ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=136112 |