Board index » delphi » Program freezes with multiple threads

Program freezes with multiple threads

Hi,
I'm trying to allow the user to run multiple threads. The threads prepare
data for a report and the launch a quickrep. The thread works fine: I've got
a progress window to give me messages and a cancel button. But when I start
a second thread the whole program stops when the 2nd thread reaches
SourceDataset.Open, which is a TIBQuery.

Do I need to do something special to allow threads?

TIA,

Mark

 

Re:Program freezes with multiple threads


"Mark Patterson" <mpatterson@ .au> schreef in bericht
news:3c637a6a_1@dnews...

Quote
> Hi,
> I'm trying to allow the user to run multiple threads. The threads prepare
> data for a report and the launch a quickrep. The thread works fine: I've
got
> a progress window to give me messages and a cancel button. But when I
start
> a second thread the whole program stops when the 2nd thread reaches
> SourceDataset.Open, which is a TIBQuery.

> Do I need to do something special to allow threads?

Yes, you do.

Each thread needs it's own connection and the connection should be a
'remote' connection. Never use the 'local' protocol - a server 'localhost'
via the TCP/IP protocol is allowed though as it is a 'remote' connection.

--
Martijn Tonies
Upscene Productions

InterBase Workbench - The Developer Tool for InterBase
http://www.interbaseworkbench.com

"Experience is what you get when you didn't get what you wanted"

Re:Program freezes with multiple threads


Quote
"Martijn Tonies" <m.ton...@upscene.nospam.com> wrote in message

news:3c63a207_2@dnews...

Quote

> "Mark Patterson" <mpatterson@ .au> schreef in bericht
> news:3c637a6a_1@dnews...
> > Hi, I'm trying to allow the user to run multiple threads. The threads
> > prepare data for a report and the launch a quickrep. The thread works
fine: I've got
> > a progress window to give me messages and a cancel button. But when I
start
> > a second thread the whole program stops when the 2nd thread reaches
> > SourceDataset.Open, which is a TIBQuery.

> > Do I need to do something special to allow threads?

> Yes, you do.

> Each thread needs it's own connection and the connection should be a
> 'remote' connection. Never use the 'local' protocol - a server 'localhost'
> via the TCP/IP protocol is allowed though as it is a 'remote' connection.

All right, thanks, I thought I'd try that out. I double clicked on my IB
database, set connection to Remote, server to Localhost, protocol to TCP,
and hit the test button. The result, after it thought for a few seconds,
was:
"Unable to complete network request to host "localhost". Failed to establish
a connection. unknown Win32 error 10061"

I hit the OK button to get the DFM data :

  object IBDatabase: TIBDatabase
    DatabaseName = 'localhost:C:\Mark Patterson - D6\Bin\Fms.gdb'
    Params.Strings = (
      'user_name=sysdba'
      'password=masterkey')
    LoginPrompt = False
    DefaultTransaction = IBTransaction
    IdleTimer = 0
    SQLDialect = 3
    TraceFlags = []
    Left = 23
    Top = 6
  end
  object IBTransaction: TIBTransaction
    Active = False
    DefaultDatabase = IBDatabase
    AutoStopAction = saNone
    Left = 21
    Top = 57
  end

Can you see what I'm doing wrong?

TIA,

Mark

Re:Program freezes with multiple threads


Quote
Mark Patterson wrote:

> All right, thanks, I thought I'd try that out. I double clicked on my IB
> database, set connection to Remote, server to Localhost, protocol to TCP,
> and hit the test button. The result, after it thought for a few seconds,
> was:
> "Unable to complete network request to host "localhost". Failed to establish
> a connection. unknown Win32 error 10061"

I occasionally see this on a reboot under W2K.  The solution has always been
stop and restart the server.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and ads to happiness in
a world in which happiness is in short supply.   (RAH)

Re:Program freezes with multiple threads


Quote
Mark Patterson wrote:

> I'm on good ol' Win 98, but I rebooted anyway, tried at all again and got
> the same error dialog.

> Any more ideas? Sorry to be apain, but I'm a bit out of my depth here.

try 127.0.0.1 instead of localhost.

Quote
> Regards,

> Mark

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and ads to happiness in
a world in which happiness is in short supply.   (RAH)

Re:Program freezes with multiple threads


"Jeff Overcash (TeamB)" <jeffoverc...@mindspring.com> wrote in message
news:3C685CCF.9FECE6D6@mindspring.com...

Quote

> Mark Patterson wrote:

> > All right, thanks, I thought I'd try that out. I double clicked on my IB
> > database, set connection to Remote, server to Localhost, protocol to
TCP,
> > and hit the test button. The result, after it thought for a few seconds,
> > was:
> > "Unable to complete network request to host "localhost". Failed to
establish
> > a connection. unknown Win32 error 10061"

> I occasionally see this on a reboot under W2K.  The solution has always
been
> stop and restart the server.

I'm on good ol' Win 98, but I rebooted anyway, tried at all again and got
the same error dialog.

Any more ideas? Sorry to be apain, but I'm a bit out of my depth here.

Regards,

Mark

Re:Program freezes with multiple threads


Quote
Mark Patterson wrote:

> "Jeff Overcash (TeamB)" <jeffoverc...@mindspring.com> wrote in message
> news:3C68604F.CBB70580@mindspring.com...

> > try 127.0.0.1 instead of localhost.

> Thanks, I tried that on your suggestion, got the same error dialog.

> Any more ideas?

You do have a remote licensed IB right?  If you only have a local license it
will not accept remote connection protocols.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and ads to happiness in
a world in which happiness is in short supply.   (RAH)

Re:Program freezes with multiple threads


"Jeff Overcash (TeamB)" <jeffoverc...@mindspring.com> wrote in message
news:3C68604F.CBB70580@mindspring.com...

Quote

> Mark Patterson wrote:

> > I'm on good ol' Win 98, but I rebooted anyway, tried at all again and
got
> > the same error dialog.

> try 127.0.0.1 instead of localhost.

Thanks, I tried that on your suggestion, got the same error dialog.

Any more ideas?

Re:Program freezes with multiple threads


Quote
> > > try 127.0.0.1 instead of localhost.

> > Thanks, I tried that on your suggestion, got the same error dialog.

> > Any more ideas?

> You do have a remote licensed IB right?  If you only have a local license
it
> will not accept remote connection protocols.

I'm using the Interbase that came with D6 Pro. I would have thought that
included at least one remote license?

Regards,

Mark

Re:Program freezes with multiple threads


Quote
Mark Patterson wrote:

> > > > try 127.0.0.1 instead of localhost.

> > > Thanks, I tried that on your suggestion, got the same error dialog.

> > > Any more ideas?

> > You do have a remote licensed IB right?  If you only have a local license
> it
> > will not accept remote connection protocols.

> I'm using the Interbase that came with D6 Pro. I would have thought that
> included at least one remote license?

Pro is local connections only.  You can add an Eval License (eval for both the
license and key) to get a 5 user eval of full IB server.  This will allow for
remote connections for 60 or 90 days (I don't remember which).

Quote

> Regards,

> Mark

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and ads to happiness in
a world in which happiness is in short supply.   (RAH)

Re:Program freezes with multiple threads


Quote

> Pro is local connections only.  You can add an Eval License (eval for both
the
> license and key) to get a 5 user eval of full IB server.  This will allow
for
> remote connections for 60 or 90 days (I don't remember which).

D'Oh! So I'm stuck, unless we start spending money, which my company has a
reputation for being against.

Regards,

Mark

Re:Program freezes with multiple threads


In article <3c68711d_2@dnews>, mpatter...@brisbane.multinail.com.au
wrote...

Hi,

Quote
> > Pro is local connections only.

> D'Oh! So I'm stuck, unless we start spending money, which my company has a
> reputation for being against.

You would have to spend money to 'deploy' anyway.  Pro only includes a
'Local' development licence.

If you want a 'free' version, then use IB Open or Firebird.

J

Re:Program freezes with multiple threads


Quote
"J Hall" <j...@hall.com> wrote in message

news:MPG.16d2833a2ec979f4989aa3@newsgroups.borland.com...

Quote
> In article <3c68711d_2@dnews>, mpatter...@brisbane.multinail.com.au
> wrote...

> Hi,

> > > Pro is local connections only.

> > D'Oh! So I'm stuck, unless we start spending money, which my company has
a
> > reputation for being against.

> You would have to spend money to 'deploy' anyway.  Pro only includes a
> 'Local' development licence.

> If you want a 'free' version, then use IB Open or Firebird.

Yes, we have Firebird, and it's installed on my colleague's machine. I was
using Interabase on my machine hoping to keep the development compatible
with Interbase and Firebird in case a client wanted the warm feeling of
having paid for the database.

Regards,
Mark

Re:Program freezes with multiple threads


Quote
> You would have to spend money to 'deploy' anyway.  Pro only includes a
> 'Local' development licence.

> If you want a 'free' version, then use IB Open or Firebird.

I just unistalled IB, installed FB, and voila, "Successful Connection". Viva
Open source. Well, excepy our product. It has to make money to pay for my
life style.

Regards,
Mark

Other Threads