Qpid
  1. Qpid
  2. QPID-4269

Qpid windows service ignore service parameters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.14, 0.16
    • Fix Version/s: 0.19
    • Component/s: C++ Broker
    • Labels:
      None
    • Environment:

      Windows

      Description

      When installing qpid as windows service (i.e. by command qpidd.exe --install --arguments --no-data-dir) qpid create service with arguments. It's fine, while you don't try to start created service. When starting servce qpid starts, but ignore all params. To be honest there is way to start service with params (by specifying they in another place for params in service dialog (greeting windows!)) but for only one start, this params not saved after closing service properties dialog

      1. qpid-4269.patch
        3 kB
        Steve Huston
      2. scm_args.patch
        2 kB
        Alexey Sviridov

        Activity

        Hide
        Alexey Sviridov added a comment -

        After a brief study of this error, I realized when qpid starts as a service he get arguments from function ServiceMain(argc, argv). But params stored in service passed not to ServiceMain, but to main(argc, argv). When the main determines that it is not running from a console, it's start ServiceMain without arguments.
        There is two possible solution at first look
        1. fast and bad - pass these parameters ServiceMain through global variables
        2. slow and good - get command line arguments right in ServiceMain, or pass arguments by another way
        Actually i'm from java world and wrote last C++ line about six years ago, so my choice was first of course.
        So my patch very ugly but works. I'm thionk someone can do this much better

        Show
        Alexey Sviridov added a comment - After a brief study of this error, I realized when qpid starts as a service he get arguments from function ServiceMain(argc, argv). But params stored in service passed not to ServiceMain, but to main(argc, argv). When the main determines that it is not running from a console, it's start ServiceMain without arguments. There is two possible solution at first look 1. fast and bad - pass these parameters ServiceMain through global variables 2. slow and good - get command line arguments right in ServiceMain, or pass arguments by another way Actually i'm from java world and wrote last C++ line about six years ago, so my choice was first of course. So my patch very ugly but works. I'm thionk someone can do this much better
        Hide
        Alexey Sviridov added a comment -

        apply through patch -p1

        Show
        Alexey Sviridov added a comment - apply through patch -p1
        Hide
        Steve Huston added a comment -

        Revised and expanded patch. Also put up on review board for input before committing.

        Show
        Steve Huston added a comment - Revised and expanded patch. Also put up on review board for input before committing.
        Hide
        Alexey Sviridov added a comment - - edited

        BTW when i'm investigate this bug i'm found a functions GetCommandLineW and CommandLineToArgvW. I'm don't have enough time to play with it, but may be this is better way to get argc and argv parameters right in ServiceMain function, isn't it?

        Show
        Alexey Sviridov added a comment - - edited BTW when i'm investigate this bug i'm found a functions GetCommandLineW and CommandLineToArgvW. I'm don't have enough time to play with it, but may be this is better way to get argc and argv parameters right in ServiceMain function, isn't it?
        Hide
        Steve Huston added a comment -

        Using GetCommandLine would be slightly more elegant, but not add any better functionality. Since I already have this working and changing it won't improve the situation, I'm going to leave it as is, at least for now.

        Fixed on trunk at r1380890.

        Show
        Steve Huston added a comment - Using GetCommandLine would be slightly more elegant, but not add any better functionality. Since I already have this working and changing it won't improve the situation, I'm going to leave it as is, at least for now. Fixed on trunk at r1380890.

          People

          • Assignee:
            Steve Huston
            Reporter:
            Alexey Sviridov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development