Jump to content

c0d3r

Members
  • Content Count

    129
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by c0d3r


  1. 54 minutes ago, Remy Lebeau said:

    That usually happens if you cause a thread deadlock inside your TIdTCPServer event handlers.  For instance, by syncing with the same thread that is trying to deactivate the server.  The Active setter closes all open client sockets, AND waits for the owning threads to terminate.  The server events are fired in the context of those threads.  So, either don't perform thread-blocking syncs during server shutdown, or else do the server deactivatation in a separate thread so the syncs can be processed normally.

    TIdTCPServer shutdown hasn't really changed between Indy 9 and 10.  Sure, the underlying architecture is a bit different, but the basics are still the same.  Although, you might have been getting saved by the TIdTCPServer.TerminateWaitTime property in Indy 9, which defaulted to 5 seconds.  If the server shutdown exceeded that timeout, an EIdTerminateThreadTimeout exception would be raised, maybe your service was crashing  and you just didn't notice it before?  That property doesn't exist in Indy 10.

    Can you show what your TIdTCPServer event handlers are doing?

    @Remy Lebeau Thanks for the answers.  Much appreciated.  We didn't write any codes for any TidTCPServer event handlers.  The TransportServer is a TkbmMWTCPIPIndyServerTransport object, it uses TIdTCPServer internally as its Socket instance. What we did was that in OnServiceStartEvent, calling TransportServer.Listen (which calls TidTCPServer.Active := True),  and in OnServiceStopEvent,  calling TransportServer.Close (which calls TidTCPServer.Active := False),  kbmMW handles everything else underneath (dealing with client side requests/server side responses).

     

    As for TerminateWaitTime property default to 5 seconds,  we never set or change it by any chance,  I thought Windows service timeout was set way longer (at least 30 seconds, we tested 90 seconds in the past) than TerminateWaitTime.  The hard part was that we can't reproduce on our development machines.  Only some of our customers who were heavily using the servers were having the issue.  We don't know how to debug at this point and where we should look at from.

     


  2. 42 minutes ago, ertank said:

    Hello,

     

    I am trying to provide client library for FirebirdSQL database connection for a MARS-Server project. I tried a few different INI parameters, all failed including second line below

    
    FireDAC.MAIN_DB.DriverID=FB
    FireDAC.MAIN_DB.VendorLib="C:\Program Files\Firebird\Firebird_2_5\WOW64\fbclient.dll"
    FireDAC.MAIN_DB.Database=C:\Program Files\Firebird\Firebird_2_5\examples\empbuild\EMPLOYEE.FDB
    

    I wonder what I should be using to be able to use a fbclient.dll in another directory than the EXE file.

     

    Thanks & Regards,

    Ertan

     

    Yes. you can as long as fbclient.dll is the right one.


  3. During last whole week, I tried to find what could be possible to cause my Windows service timeout while calling TidTCPServer.Active := False,  I'm using Delphi 10.4.1,  codes were working fine in Delphi 2007 with Indy 9+ until we migrated to 10.4.1:

     

    procedure TMyService.OnStop(...)

    begin

        TransportServer.Close ;  <-- Error 1053 occurs.

    end;

     

    TransportServer is a type of TkbmMWTCPIPIndyServerTransport, the Close method internally was just calling TidTCPServer.Active := False;

     

    I can't figure it out because if i don't stop the service,  it would serves the client requests/responses without any issue for weeks until at the point the users want to stop the service.


  4. Solved the issue, but I don't understand the reason why, I had like:

     

    SaveIndex := SaveDC(Canvas.Handle);

    try

       IntersectClipRect(Canvas.Handle, .....);

       PaintRows(Canvas, ...);

    finally

        RestoreDC(Canvas.Handle, SaveIndex);

    end;

     

    The codes in procedure PaintRows:

     

    SaveIndex2 := SaveDC(ACanvas.Handle);

    try

       IntersectClipRect(ACanvas.Handle, .....);

       .....

       PaintCells(ACanvas, ...);

       ......

    finally

        RestoreDC(ACanvas.Handle, SaveIndex2);

    end;

     

    By removing the SaveDC/RestoreDC from procedure PaintRows, it solves,  but Why?   can't nest call SaveDC/RestoreDC??


  5. 13 minutes ago, Anders Melander said:

    I know the SaveDC/RestoreDC doesn't solve your problem. In my code it's just there to leave the canvas in the same state as it was in when I got it. The key point from my code was the clearing of the pen handle since in my case I had problems with the pen color.

     

    Try reversing the order of the pen and brush assignments. I've had similar problems and as far as I remember that was what I did to solve it.

    Tried reversing the order of pen and brush assignments,  doesn't work either.


  6. @Anders Melander tried yours but still the same issue:

    procedure DrawTriangle(ACanvas: TCanvas; AColor: TColor; ARect: TRect);
    var
      SaveIndex: Integer;
    begin
      ACanvas.Lock;
      try
        SaveIndex := SaveDC(ACanvas.Handle);
        try
          ACanvas.Brush.Style := bsSolid;
          ACanvas.Brush.Color := clBlack;
          ACanvas.Pen.Color := clBlack;
          ACanvas.Polygon([Point(ARect.Right - 1, ARect.Bottom - 10), Point(ARect.Right - 1, ARect.Bottom - 1),
                           Point(ARect.Right - 10, ARect.Bottom - 1)]);
        finally
          RestoreDC(ACanvas.Handle, SaveIndex);
        end;
      finally
       ACanvas.Unlock;
      end;
    end;

     

    image.thumb.png.810ea1b34fbad1c20bd867f31b97c51a.png


  7. Hi,

     

    For the last couple of days I tried figure out the issue about Canvas.Polygon wasn't working properly.   Here is my routine:

     

    procedure DrawTriangle(ACanvas: TCanvas; AColor: TColor; ARect: TRect);
    begin
      ACanvas.Brush.Style := bsSolid;
      ACanvas.Brush.Color := ColorToRGB(clRed); //ColorToRGB(AColor);
      ACanvas.Pen.Color := ColorToRGB(clRed); //ColorToRGB(AColor);
      //ACanvas.Pen.Mode := pmCopy;
      ACanvas.Polygon([Point(ARect.Right - 1, ARect.Bottom - 10), Point(ARect.Right - 1, ARect.Bottom - 1),
                       Point(ARect.Right - 10, ARect.Bottom - 1)]);
    end;

     

    if I passed clRed as one of the Color parameter on the red background, it drawed a white triangle,  as you see from the below screenshot,. It was only painted right at the most right column.  Even I hard coded to set color to clRed, it still drawed a white triangle.

     

     

    DrawTriangle.thumb.PNG.6dc35b19d4ba2bd4f07621d6839ff546.PNG

     

     

    I just can't figure out what I was doing wrong.

     


  8. Nature:

     

    The brick red represents: Flowers,  The green: Forest, the orange/yellow: Moon/Sun,  the cream white: Clouds,  the dark blue background:  Deep ocean,   the light green (blueish, used for comments) : Rivers.  the brown white space:  earth.  the Sky blue brace pair highlight: The Sky.  The red error lines:  Fire.

     

    Editor2.thumb.PNG.eb599010d31ab6b7f4b2e5c2ddb909c8.PNG

     

    File:

     

    c0d3r-YW-Nature.theme.xml

     

     

    • Like 3

  9. Some one is asking for my themes, so I thought its better to create a new post to benefit any one who like them, I called them "Nature" themes,  one Nature original theme and one Nature Warm theme, you may use Delphi IDE theme editor (https://github.com/RRUZ/delphi-ide-theme-editor) to apply them:

     

    Please click Like if you enjoy it.

     

    Nature warm (based on my Nature original theme):

     

    1.thumb.PNG.cee2a497e285af36aec5bde388c297f1.PNG

     

    File:

     

    c0d3r-YW-Nature-warm.theme.xml

     

     

    • Like 3

  10. 7 hours ago, Gary Mugford said:

    I could use that. Orange and Brick Red are playmates for green out in the wild.  

    I called my this IDE colour schema : Nature.  the red: Flowers,  the green: Forest, the orange/yellow: Moon/Sun,  the cream white: Clouds,  the dark blue background:  Deep ocean,   the light green (a bit blueish) : Rivers.  the brown white space:  earth.  the Sky blue brace pair highlight: The Sky.  The red error lines:  Fire.


  11. I had exact the same issue.  See the screenshot.

     

    Its reproducible if I ctrl-shift-up to the procedure declaration section, then ctrl-shift-down back to the procedure body, then move the cursor, you would see it.  However, I'm in a VM though.

     

    Cursor.PNG.0f6e803ac72e2452da13d31cd9e696dc.PNG

×