* Re: Alpha's,MySQL and thread problems. [not found] <14716.56609.351817.847998@tik.mysql.com> @ 2000-07-25 17:22 ` Alvin Starr 2000-07-25 17:42 ` Brian Pomerantz 0 siblings, 1 reply; 8+ messages in thread From: Alvin Starr @ 2000-07-25 17:22 UTC (permalink / raw) To: Michael Widenius; +Cc: mysql, axp-list, grimmer On Tue, 25 Jul 2000, Michael Widenius wrote: > Hi! > > >>>>> "Alvin" == Alvin Starr <alvin@iplink.net> writes: > > Alvin> Ok I think I found it this time > > GREAT! Of course I am sure that someone will say that it is a "heisenberg effect" :) > Alvin> The problem I would see is that MySQL would crash in cases where there are > Alvin> a large number of connections being created/destroyed. I was able to track > Alvin> this problem down to pthread_create. > > Alvin> 1 int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr, > Alvin> 2 void * (*start_routine)(void *), void *arg) > Alvin> 3 { > Alvin> 4 pthread_descr self = thread_self(); > Alvin> 5 struct pthread_request request; > Alvin> 6 if (__pthread_manager_request < 0) { > Alvin> 7 if (__pthread_initialize_manager() < 0) return EAGAIN; > Alvin> 8 } > Alvin> 9 THREAD_GETMEM(self, p_retcode)=0xdeadbeef ; > Alvin> 10 *thread = 0; > Alvin> 11 request.req_thread = self; > Alvin> 12 request.req_kind = REQ_CREATE; > Alvin> 13 request.req_args.create.attr = attr; > Alvin> 14 request.req_args.create.fn = start_routine; > Alvin> 15 request.req_args.create.arg = arg; > Alvin> 16 sigprocmask(SIG_SETMASK, (const sigset_t *) NULL, > Alvin> 17 &request.req_args.create.mask); > Alvin> 18 __libc_write(__pthread_manager_request, (char *) &request,sizeof(request)); > Alvin> 19 suspend(self); > Alvin> 20 while(THREAD_GETMEM(self, p_retcode) == 0xdeadbeef)sched_yield(); > Alvin> 21 > Alvin> 22 *thread = 0; > Alvin> 23 > Alvin> 24 if (THREAD_GETMEM(self, p_retcode) == 0) > Alvin> 25 *thread = (pthread_t) THREAD_GETMEM(self, p_retval); > Alvin> 26 return THREAD_GETMEM(self, p_retcode); > Alvin> 27} > > Alvin> this is pthread from 2.1.3-16. Lines 9,10,20,22 are new. > > Alvin> Using GDB I found that mysql would crash on line 25 regularly with a > Alvin> segmentation fault. With a little probing I came up with line 22. This > Alvin> code would then crash on line 22 but at no time did line 10 ever cause a > Alvin> crash. > > Alvin> I install lines 9 and 20. The problem goes away. > > Alvin> To try and make sure It is not a compiler induced bug/fix I change the > Alvin> while loop so that it never loops. The problem comes back. I set a > Alvin> breakpoint on sched_yield but did not manage to get it to trigger. The > Alvin> lack of triggering bothers me a bit. > > I think the reason is that when you set a breakpoint with gdb, you > will affect the scheduling of threads a bit or the other thread will > continue to run for a while after the first thread hits a breakpoint ; > The result is that the new thread has time to finish the creation > process before it gets stopped.. I had a feeling that that may be what is happening but I am not positive. > Alvin> My conclusions: > Alvin> 1) I believe that in this code suspend is expected to only return after > Alvin> the new thread has started. It appears that in some cases it returns > Alvin> before the new thread has been created. If suspend returns early the > Alvin> values of retcode and retval are undifined. > > Sounds as a likle cause of this problem. Rembmbering back to my days working with real-time systems and BSD4.1 you would allways test to insure that the condition you wrere wating on was complete and not just take off running. > Alvin> 2) At some point in the execution of the program *thread becomes invalid > Alvin> memory. This is a difficult thing to have happen since this is the > Alvin> memory in the process that is calling thread_create. This rases the > Alvin> question of if there is some point in the process of thread creation > Alvin> where the of the creating threads memory model becomes invalid? Are > Alvin> mmap and clone thread save? > > I can't see any reason why 'thread' would ever point at something > 'undefined'; Did you try to compile the above code without > optimization to ensure that gcc has not rearranged the instructions so > that you are actually hitting line 24 even if you think you are > getting an segfault at 22 ? I did look through the assembler and it looked like things were happening in a reasonable order. The interesting thing was that by the time the debugger got control the memory was valid. I rearranged the code and added some other variables to verify that the memory was valid before the call to write(). Remember way back we talked about the idea that mmap may not be thread safe or atomic across several processes. I think that this points to the same type of problem. > Alvin> I have been running my little stress test for several hours now and have > Alvin> not seen any problems yet. Before my changes my test program would cause > Alvin> the server to crash within 5-10 minutes. > > Sounds good! Things have been running quite reliable for over a week now so I think that this may be the problem. I think I will raise this one in the kernel and Alpha groups. I have to admit that I was supprised that I did not get any feedback at all. > Regards, > Monty > > PS: Sorry for the delayed; I am answering mails on my laptop > while being away on a conference trip in the USA; Until I am back > home my mails may be a bit delayed... Do you ever get up to Canada? Hope you are having a plesent time in the USA. Alvin Starr || voice: (416)585-9971 Interlink Connectivity || fax: (416)585-9974 alvin@iplink.net || ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's,MySQL and thread problems. 2000-07-25 17:22 ` Alpha's,MySQL and thread problems Alvin Starr @ 2000-07-25 17:42 ` Brian Pomerantz 2000-07-25 18:47 ` Interbase vs. MySQL on Alpha Jamesvi [not found] ` <Pine.GSO.3.96.1000725114416.27202A-100000@general2.asu.edu > 0 siblings, 2 replies; 8+ messages in thread From: Brian Pomerantz @ 2000-07-25 17:42 UTC (permalink / raw) To: Alvin Starr; +Cc: Michael Widenius, mysql, axp-list, grimmer On Tue, Jul 25, 2000 at 01:22:22PM -0400, Alvin Starr wrote: > > Things have been running quite reliable for over a week now so I think > that this may be the problem. > > I think I will raise this one in the kernel and Alpha groups. I have to > admit that I was supprised that I did not get any feedback at all. > We've been seeing thread problems as well here at LLNL. None of us have had time to look into it more. We're working on a parallel file system and when we ran with pthreads, it would cause the server to hang shortly after starting (it uses a work pile for handling requests). Some researchers over at Compaq's SRC took the pthread code and strip a bunch of code out of it to make a thread library that wouldn't hang. I was told that they sent a message to Xavier Leroy about the problem, but I don't know for sure that anything was done about it. From what I understand, there are missing memory barriers in the locking routines. I've seen condition variables fall through when another thread has already grabbed the mutex (more than one thread holding a mutex at once). They seemed to think the problem existed on Intel as well but it seems to be a little harder to trigger. BAPper ^ permalink raw reply [flat|nested] 8+ messages in thread
* Interbase vs. MySQL on Alpha 2000-07-25 17:42 ` Brian Pomerantz @ 2000-07-25 18:47 ` Jamesvi 2000-07-25 19:03 ` Brian Pomerantz [not found] ` <Pine.GSO.3.96.1000725114416.27202A-100000@general2.asu.edu > 1 sibling, 1 reply; 8+ messages in thread From: Jamesvi @ 2000-07-25 18:47 UTC (permalink / raw) To: axp-list Borland just open sourced interbase. Would there be any advantage to spending mmy time trying to get this to compile and run on my PWS (miata) rather than MySQL? My particular paramteres are basically: secure, scalable, easy to write web-enabled access. Thanks for any input. James ------------------------------------------------------------------------------ James Fowler Graduate Student Political Science & Latin America Arizona State University jamesvi@asu.edu ICQ: 22088266 ----------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interbase vs. MySQL on Alpha 2000-07-25 18:47 ` Interbase vs. MySQL on Alpha Jamesvi @ 2000-07-25 19:03 ` Brian Pomerantz 0 siblings, 0 replies; 8+ messages in thread From: Brian Pomerantz @ 2000-07-25 19:03 UTC (permalink / raw) To: Jamesvi; +Cc: axp-list On Tue, Jul 25, 2000 at 11:47:19AM -0700, Jamesvi@asu.edu wrote: > Borland just open sourced interbase. Would there be any advantage to spending > mmy time trying to get this to compile and run on my PWS (miata) rather than > MySQL? My particular paramteres are basically: secure, scalable, easy to > write web-enabled access. Thanks for any input. > It has been a while since I used either of those databases, but my impression of Interbase of VERY favorable. It is fast, small, and robust. It has a concept of transactions which I don't think MySQL has. I think it also has foreign keys and triggers as well as a sqlplus (Oracle's scripting language) like language for creating procedures and functions that are stored in the database. I would say it is worth at least looking at. BAPper ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <Pine.GSO.3.96.1000725114416.27202A-100000@general2.asu.edu >]
* Re: Interbase vs. MySQL on Alpha [not found] ` <Pine.GSO.3.96.1000725114416.27202A-100000@general2.asu.edu > @ 2000-07-25 19:16 ` Maurice Hilarius 2000-07-25 19:56 ` Michal Jaegermann 0 siblings, 1 reply; 8+ messages in thread From: Maurice Hilarius @ 2000-07-25 19:16 UTC (permalink / raw) To: axp-list With regards to your message at 11:47 AM 7/25/00 -0700, Jamesvi@asu.edu. Where you stated: >Borland just open sourced interbase. Would there be any advantage to spending >mmy time trying to get this to compile and run on my PWS (miata) rather than >MySQL? My particular paramteres are basically: secure, scalable, easy to >write web-enabled access. Thanks for any input. >James IMHO, the fact that is supports rollback functions by itself makes it worth looking at.. With our best regards, Maurice W. Hilarius Telephone: 01-780-456-9771 Hard Data Ltd. FAX: 01-780-456-9772 11060 - 166 Avenue mailto:maurice@harddata.com Edmonton, AB, Canada http://www.harddata.com/ T5X 1Y3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interbase vs. MySQL on Alpha 2000-07-25 19:16 ` Maurice Hilarius @ 2000-07-25 19:56 ` Michal Jaegermann 2000-07-25 20:16 ` Maurice Hilarius 0 siblings, 1 reply; 8+ messages in thread From: Michal Jaegermann @ 2000-07-25 19:56 UTC (permalink / raw) To: axp-list Maurice Hilarius wrote: > > With regards to your message at 11:47 AM 7/25/00 -0700, Jamesvi@asu.edu. > Where you stated: > >Borland just open sourced interbase. Would there be any advantage to spending > >mmy time trying to get this to compile and run on my PWS (miata) rather than > >MySQL? My particular paramteres are basically: secure, scalable, easy to > >write web-enabled access. Thanks for any input. > >James > IMHO, the fact that is supports rollback functions by itself makes it worth > looking at.. There is a catch. A download page for Interbase states, roughly, "these sources are useless without Delphi and Borland C++". No idea at this moment how seriously one should take this. :-) Probably some exaggregation but how much of work is really involved remains to be seen. Michal ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interbase vs. MySQL on Alpha 2000-07-25 19:56 ` Michal Jaegermann @ 2000-07-25 20:16 ` Maurice Hilarius 2000-07-25 21:11 ` Jamesvi 0 siblings, 1 reply; 8+ messages in thread From: Maurice Hilarius @ 2000-07-25 20:16 UTC (permalink / raw) To: axp-list With regards to your message at 01:56 PM 7/25/00 -0600, Michal Jaegermann. Where you stated: >There is a catch. A download page for Interbase states, roughly, >"these sources are useless without Delphi and Borland C++". No idea at >this moment how seriously one should take this. :-) Probably some >exaggregation but how much of work is really involved remains to be >seen. True, but Borland C++ also got Open Sourced. So that may be helpful.. With our best regards, Maurice W. Hilarius Telephone: 01-780-456-9771 Hard Data Ltd. FAX: 01-780-456-9772 11060 - 166 Avenue mailto:maurice@harddata.com Edmonton, AB, Canada http://www.harddata.com/ T5X 1Y3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interbase vs. MySQL on Alpha 2000-07-25 20:16 ` Maurice Hilarius @ 2000-07-25 21:11 ` Jamesvi 0 siblings, 0 replies; 8+ messages in thread From: Jamesvi @ 2000-07-25 21:11 UTC (permalink / raw) To: axp-list Has any of this been previously ported to Alpha, that any one knows of? (obviously not Interbase, but Borland C++ or anything realtive to this getting interbase to work) TIA, James ------------------------------------------------------------------------------ James Fowler Graduate Student Political Science & Latin America Arizona State University jamesvi@asu.edu ICQ: 22088266 ----------------------------------------------------------------------------- On Tue, 25 Jul 2000, Maurice Hilarius wrote: > With regards to your message at 01:56 PM 7/25/00 -0600, Michal Jaegermann. > Where you stated: > >There is a catch. A download page for Interbase states, roughly, > >"these sources are useless without Delphi and Borland C++". No idea at > >this moment how seriously one should take this. :-) Probably some > >exaggregation but how much of work is really involved remains to be > >seen. > True, but Borland C++ also got Open Sourced. So that may be helpful.. > > > With our best regards, > > Maurice W. Hilarius Telephone: 01-780-456-9771 > Hard Data Ltd. FAX: 01-780-456-9772 > 11060 - 166 Avenue mailto:maurice@harddata.com > Edmonton, AB, Canada http://www.harddata.com/ > T5X 1Y3 > > > -- > To unsubscribe: send e-mail to axp-list-request@redhat.com with > 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com > > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2000-07-25 21:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <14716.56609.351817.847998@tik.mysql.com>
2000-07-25 17:22 ` Alpha's,MySQL and thread problems Alvin Starr
2000-07-25 17:42 ` Brian Pomerantz
2000-07-25 18:47 ` Interbase vs. MySQL on Alpha Jamesvi
2000-07-25 19:03 ` Brian Pomerantz
[not found] ` <Pine.GSO.3.96.1000725114416.27202A-100000@general2.asu.edu >
2000-07-25 19:16 ` Maurice Hilarius
2000-07-25 19:56 ` Michal Jaegermann
2000-07-25 20:16 ` Maurice Hilarius
2000-07-25 21:11 ` Jamesvi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox