Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a QuickLogger to the USES section of the DLL causes to application to hang #55

Open
charactell-public opened this issue Jul 7, 2021 · 5 comments

Comments

@charactell-public
Copy link

Delphi 10.4

I am trying to add a file logger to my simple DLL application:

uses
  System.SysUtils,
  System.Classes,
{$IFDEF VER340}
  Quick.Logger,
  Quick.Logger.Provider.Files
{$ENDIF}
    ;

function FieldOfExperiments(): longint; stdcall;
begin
  Result := 0;
  try
  except
    on E: Exception do
  end;
end;

exports
    FieldOfExperiments;
{$R *.res}
begin
end.

When the main application attempts to load the DLL, the application gets unresponsive and hangs:

image

Any ideas? Did I miss something?

Thanks
Vitaly

@turric4n
Copy link
Contributor

turric4n commented Jul 7, 2021

QuickLogger can be called from a DLL without problems, we do it from .NET for example. Your code seems fair, but you need to post your DLL client code. Where are you calling your DLL? What language are you using to load and call your DLL??

@charactell-public
Copy link
Author

charactell-public commented Jul 7, 2021 via email

@JWBokx
Copy link

JWBokx commented Nov 15, 2021

Hello all,

I'm new here and landed here searching a solution for my problem.
I use the quick library and logger already in standard VCL programs with no problems at all.

Now my colleague and I are building a plugin for Outlook and Word.
For this we are using the components of add-in express.
So we're building a COM plugin for local instance of office.
This is a dll too.
The problem is when closing Word, It hangs.
In outlook this isn't a problem, so just word.

Debugging it I found the point it stops responding.
In Quick,Logger.pas at line 1315:

  fThreadProviderLog.Terminate;
  fThreadProviderLog.WaitFor;
  fThreadProviderLog.Free;
  //if Assigned(fProviders) then fProviders.Free;
  FreeAndNil( fProviders );
  fCustomTags := nil;
  FreeAndNil( fLogQueue ); 

The .WaitFor is never returning...
I also had a breakpoint in the thread that has to stop, the while loop is ended correctly.
So it seems the thread is terminatied after the calling of .Terminate method.

I don't know this problem is the same as described here, but hopefully it gives a clue.
Or do I have to open a new issue?

Kind regards,

Jan

@FreezerUa
Copy link

Hello,
i got similar issue.
I create empty Apache dynamic link module in Delphi 10.4.2, build it into Ubuntu Linux, configure Apache to load it and all works fine.
But when i just add Quick.Logger into uses section - Apache fail to start.
Console application with Quick.Logger works fine on same PC, so i can't even debug what's a problem.

Any suggestions?

@FreezerUa
Copy link

I removed automatic creation of Logger from initialization section of Quick.Logger and Apache module get back to work.
Seems like Apache works in some specific mode when try to load external modules in initialization. So issue is somehow related to work in this mode.
Manual creating of Logger instance in OnCreate event of TWebModule class can bypass this problem, but I'm not sure that this is right way of solving issue.
Anyway adding some {$IFDEF} into initialization section to prevent default creation can be useful in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants