PDA

View Full Version : Communication Server & CSEVENT.EXE issue



nurowolf
January 16th, 2006, 08:20 PM
Hi This is a replacement thread for a previous thread that was dealing with many issues as part of one thread. This thread deals with a single issue (as the title describes).

For background - please refer to the following link http://www.promixis.com/phpBB2/viewtopic.php?p=137416#137416

Communication Server Issue
I have the communication server setup in Girder Pro.
I am using GBPVR as my PVR. In turn it uses CSEVENT.EXE to Talk to girder to change the channel. The Physcial device changing the channel is a GlobalCache.

I have a script that is triggered that takes the Payload from the CSEVENT.EXE and sends individual channel changes commands to GloBalCache.

Here is the issue.

The Communication Server acknowledges as connection is received when CSEVENT>EXE is executed, but it does not always trigger the event.

Rob H
January 17th, 2006, 07:27 AM
Okay, I can reproduce the non-logging of the itest event here.

It's caused by a setting for the NetRemote feedback. If you have Log Messages unchecked then you don't get to see the events.

nurowolf
January 17th, 2006, 08:06 AM
Hey Rob

Even with the
- Enable Netremote - Ticked

and

- Log Messages - Ticked

I still get the event itest not shown. It seems to almost be random in when it happens and when it doesn't.

Rob H
January 17th, 2006, 08:31 AM
Looking at the screen shot you posted it does look as though it's every other one that works.

Can you post the GML here?

nurowolf
January 17th, 2006, 09:30 AM
Sure Can

nurowolf
January 17th, 2006, 09:33 AM
Rob,

I have included all my GMLs for you just in case there is something in one of them causing problems.

The iCable.GML is the one responsible for changing the channel.

Note that I have given you the more basic one (without the itest script. I have done this as the errors are occurring regardless of whether i use a cript or just events

Ron
January 17th, 2006, 09:49 AM
Rob is this error related to the NR script or not?

Rob H
January 17th, 2006, 10:39 AM
No, I don't think it is - I think it was a coincidence

However, I am seeing the same thing that nurowolf is describing, but it is quite intermittent. I've just tried the following command 11 times in succession :-


csevent localhost 20005 girder 10 18

Out of those 11 attempts 3 of them failed, ie the connection was closed opened and then closed.

Second try, 21 attempts 2 of them failed.

I'm afraid I can't see any sort of pattern :(

nurowolf
January 17th, 2006, 10:40 AM
Hi Guys

Thanks for the help so far.

I leave for the US tomorrow, and wont be back in Hong Kong until the 2nd Feb, so from Thursday onwards I will only be able to provide you with limited info about this issue.

If nobody else is suffering from this problem then you may wish to give it a lower priority - I can always give the thread a bump when I get back

Cheers
Mark

Rob H
January 17th, 2006, 10:48 AM
Aha!

When it fails csevent.exe is returning an error code of -1, when it succeeds it returns 1

Ron
January 17th, 2006, 12:57 PM
hmm, I wonder why it fails.

Rob H
January 17th, 2006, 02:02 PM
If you want to create a version that sends more info to OutputDebugString() then I'm happy to test it since Mark probably won't be able to.

nurowolf
January 17th, 2006, 07:41 PM
So Rob,

Does that mean it is something in 1 of my GMLs that is conflicting with the Comm Server, or is this problem independent of my configuration.

Cheers
Mark

Rob H
January 18th, 2006, 04:03 AM
It seems to be independent of your configuration

nurowolf
January 18th, 2006, 04:08 AM
So that a postive and a negative

Positive - I am not a complete Noob and screwed up my system :lol:

Negative - I gotta wait for a fix to get my Rig working properly. :(

Thanks for the feedback Rob.

Rob H
January 18th, 2006, 04:35 AM
No problem - enjoy yourself in the US.

We'll hopefully have a solution for you by the time you touch down at Chek Lap Kok

Ron
January 23rd, 2006, 10:53 AM
The next Girder version (4.0.2) some some debug output included, I have ran this here but was unable to see what was causing the error. So if you could check that would be great.

Rob H
January 23rd, 2006, 11:26 AM
Sure, will do

Rob H
January 24th, 2006, 04:17 AM
This version seems more prone to failure.

4 failures out of 8

The error I get in DebugView is "WaitForSingleObjectFailed" in the csevent.exe process

No messages from Girder though

Ron
January 24th, 2006, 10:37 AM
Due to an installer mistake I am updating the 4.0.2 download and I have made the timeout waiting for a connection a little longer. I had it set to 1 second, which obviously was too short. I'll post when I have update the installer.

Thanks

Ron
January 24th, 2006, 10:50 AM
The new installer (4.0.2.302) has been uploaded.

Rob H
January 24th, 2006, 11:04 AM
You appear to have made the timeout 10 seconds - it still fails approximately 50% of the time, again in the WaitForSingleObject call

Ron
January 24th, 2006, 11:17 AM
That is the weirdest thing. when it fails do you see a connection in Girder?

Rob H
January 24th, 2006, 11:31 AM
Yes.

In chronological order :-

[icon 0] Communication Server Connection Authenticated 127.0.0.1 csevent
[icon 5] Communication Server New Client Connection
[icon 0] Communication Server Close Connection
[icon 5] Communication Server Close Connection

It'd be a lot easier if we could copy and paste from the log display you know!

:wink:

Ron
January 24th, 2006, 11:32 AM
:-) Yeah I know.

Ron
January 24th, 2006, 11:33 AM
Between connect and close is there 10 seconds or pretty much instantaneous?

Ron
January 24th, 2006, 11:35 AM
Please try this csevent with the debug output viewer

Rob H
January 24th, 2006, 11:37 AM
Between connect and close is there 10 seconds or pretty much instantaneous?
It's about 10 seconds - the close is near as dammit simultaneous with the WaitForSingleObject failed message in DebugView

Rob H
January 24th, 2006, 11:40 AM
No difference in debug viewer with that version

Ron
January 24th, 2006, 11:42 AM
but if it connects and sends you should have seen some extra information right?

edit: connects and sends...

Rob H
January 24th, 2006, 11:44 AM
Yes, it's just that it failed 3 times in succession :)

Here's one that worked :-


[5216] Loading C:\Program Files\Promixis\Girder\comserverlib.dll at Base Address 0x7E920000
[5216] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\csevent.exe
[5216] ConnectEvent! Sent: 2
[5216] ACK received: 2

Ron
January 24th, 2006, 11:50 AM
It would seem that the connect event sometimes is not received,.. or maybe not sent...

Ron
January 24th, 2006, 11:53 AM
This is quite frustrating, I can't get it to fail here at all. what is your commandline that you are using?

Rob H
January 24th, 2006, 12:02 PM
csevent localhost 20005 girder 10 18

Rob H
January 24th, 2006, 12:08 PM
FWIW I'm using XP SP2 on an Athlon 64 3200

Ron
January 24th, 2006, 12:13 PM
Should not matter....

Please try this one with the debug view enabled again.

Rob H
January 24th, 2006, 12:17 PM
Successful connection :-

[5612] Loading C:\Program Files\Promixis\Girder\comserverlib.dll at Base Address 0x7E920000
[5612] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\csevent.exe
[5612] 0: Outgoing Connection Authenticated
[5612] ConnectEvent! Sent: 2
[5612] ACK received: 2
[5612] 0: Close Connection


Unsuccessful connection :-

[628] Loading C:\Program Files\Promixis\Girder\comserverlib.dll at Base Address 0x7E920000
[628] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\csevent.exe
[628] WaitForSingleObject Failed
[628] 0: Close Connection

Ron
January 24th, 2006, 12:19 PM
Seems like it never gets the authorized message.

Ron
January 25th, 2006, 10:47 AM
Alright, can you run this code:




local function cb ( c, arg1, arg2, arg3, arg4)

if arg1== comserv.CMD.AUTH_SUCCESS then
print('Connection to "'..c.Host..'" Authenticated, Sending Event...')
c.Sequence = c.c:SendEvent(c.EventString, c.EventDevice, c.KeyMod, c.p1, c.p2, c.p3, c.p4)
return
end

if arg1== comserv.CMD.AUTH_FAIL then
print('Connection Authentication to "'..c.Host..'" Failed')
return
end

if arg1== comserv.CMD.CONNECT_FAILED then
print('Connect to "'..c.Host..'" Failed')
return
end

if arg1 == comserv.CMD.CLOSE then
print('Connection to "'..c.Host..'" Closed')
return
end

if arg2 == c.Sequence then
print('Connection "'..c.Host..'" Ack`d SendEvent')
c.c:Close()
end

end


local function SendEvent ( Host, Port, Password, EventString, EventDevice, KeyMod, p1,p2,p3,p4 )

local t = {
Host = Host,
Port = Port,
Password = Password,
EventString = EventString,
EventDevice = EventDevice or 18,
KeyMod = KeyMod or 0,
p1 = p1,
p2 = p2,
p3 = p3,
p4 = p4
}

local x = function (...) return cb(t, unpack (arg)) end
t.c = comserv.NewConnection(Host, Port, Password, x)

end

SendEvent('localhost',20005,'girder', 'SomeEventHere', 18)


This does pretty much the same as the CSEVENT.EXE so it should exhibit the same behaviour. Let me know.

Rob H
January 25th, 2006, 02:58 PM
Okay, it occasionally fails on this line :-


c.Sequence = c.c:SendEvent(c.EventString, c.EventDevice, c.KeyMod, c.p1, c.p2, c.p3, c.p4)
saying that c is nil - since this follows a line of code that prints c.Host I assume that it's actually c.c that is nil

Rob H
January 26th, 2006, 03:23 PM
Any news Ron? Does this indicate that the problem is in communication server?

What is CSEVENT.EXE written in? If it's Delphi then I can debug it here if you'll send me the source code.

Ron
January 26th, 2006, 03:25 PM
CSEvent is written in C++. There is actually hardly any code in CSEvent it fully reuses the ComServer classes.

The error above just means that the .c member of that field simply wasn't set yet. TRy including a win.Sleep in the callback



if arg1== comserv.CMD.AUTH_SUCCESS then
win.Sleep(500)
print('Connection to "'..c.Host..'" Authenticated, Sending Event...')
c.Sequence = c.c:SendEvent(c.EventString, c.EventDevice, c.KeyMod, c.p1, c.p2, c.p3, c.p4)
return
end

Rob H
January 26th, 2006, 03:36 PM
Okay.

Unfortunately, I can't get the Lua version to fail.

:(

Ron
January 26th, 2006, 03:41 PM
Can you try to do this from Lua to a different machine? Does csevent fail when talking to a different machine?

Rob H
January 26th, 2006, 03:52 PM
I can't get that to fail either, it only fails over a local connection.

I did try using 127.0.0.1 rather than 'localhost' in case it was a DNS lookup issue, but they both fail in the same way.

Ron
January 26th, 2006, 03:58 PM
So Lua works all the time.

CSEvent only fails on a local connection.

Sounds like a timing issue of sorts.

Rob H
January 26th, 2006, 04:00 PM
That's the conclusion that I was coming to as well - I hate those!

Ron
January 26th, 2006, 04:13 PM
Indeed these are the worst. Can you put csevent.exe in a separate directory and drop this .dll in there. Then run debugview to see all the output. This dumps some data along the way inside the connection.

We put this in a separate directory so that the server doesn't also produce debug output, that would be too confusing.

Rob H
January 26th, 2006, 04:33 PM
[1148] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[1148] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[1148] length: 16, data=49 03 00 00 08 00 00 00 0a e7 00 00 5c 6a 13 fa
[1148] length: 23, data=4a 03 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 ea 09 15 3b
[1148] 0: Outgoing Connection Authenticated
[1148] ConnectEvent! Sent: 2
[1148] length: 20, data=4b 03 00 00 02 00 00 00 02 00 00 00 01 00 00 00 c6 fb 12 c8
[1148] ACK received: 2
[1148] 0: Close Connection
[4460] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[4460] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[4460] length: 16, data=4c 03 00 00 08 00 00 00 6c f5 00 00 44 26 10 07
[4460] length: 23, data=4d 03 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 65 b0 57 0d
[4460] WaitForSingleObject Failed
[4460] 0: Close Connection
Process ID 1148 succeeded and 4460 failed

Ron
January 26th, 2006, 09:18 PM
That is good news, at least the data makes it to the client. Please try this one:

Rob H
January 27th, 2006, 02:44 AM
I can't get that one to fail, so I hope that was the intention :)

Ron
January 27th, 2006, 10:32 AM
No I only added debug outputs, which probably slowed the thing down long enough for it all to work :evil:

With less Debug output:

Rob H
January 28th, 2006, 08:31 AM
One success and one failure :-


[1652] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[1652] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[1652] length: 16, data=00 05 00 00 08 00 00 00 1c b0 00 00 0d 81 13 7e
[1652] length: 23, data=01 05 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 00 2d 96 f0
[1652] fAuthSuccess 1
[1652] 0: Outgoing Connection Authenticated
[1652] ConnectEvent! Sent: 2
[1652] length: 20, data=02 05 00 00 02 00 00 00 02 00 00 00 01 00 00 00 38 d9 df 9f
[1652] ACK received: 2
[1652] 0: Close Connection
[3104] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[3104] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[3104] length: 16, data=03 05 00 00 08 00 00 00 48 87 00 00 f1 4a 6e 0f
[3104] length: 23, data=04 05 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 3d 84 e3 d2
[3104] fAuthSuccess 1
[3104] WaitForSingleObject Failed
[3104] 0: Close Connection

Ron
January 30th, 2006, 04:41 PM
I still can't see where this is messing up. Please try the attached library. ( in separate directory again).

THANKS!

Rob H
January 30th, 2006, 05:06 PM
Doesn't fail I'm afraid (after 1000+ iterations)

Although the first time I tried my machine blue screened after about 80 or 90 iterations.

Ron
January 30th, 2006, 05:31 PM
Darn, putting too much debug output in there prevents the bug from popping up.

Rob H
January 30th, 2006, 05:38 PM
Failed on the first attempt!


[1188] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[1188] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[1188] length: 16, data=03 0c 00 00 08 00 00 00 5c ec 00 00 5d e3 92 ef
[1188] length: 23, data=04 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 3c 97 be 4b
[1188] fAuthSuccess 1b
[1188] WaitForSingleObject Failed
[1188] 0: Close Connection

Ron
January 30th, 2006, 05:40 PM
Alright, moving the debug one step further.

Rob H
January 30th, 2006, 05:43 PM
10 attempts


[2860] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[2860] length: 16, data=20 0c 00 00 08 00 00 00 a0 2f 00 00 4b 23 56 6e
[2860] length: 23, data=21 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 96 28 7b 2e
[2860] fAuthSuccess 1c
[2860] WaitForSingleObject Failed
[2860] 0: Close Connection

Ron
January 30th, 2006, 05:45 PM
...

Rob H
January 30th, 2006, 05:46 PM
[3372] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[3372] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[3372] length: 16, data=22 0c 00 00 08 00 00 00 56 da 00 00 ca 63 04 71
[3372] length: 23, data=23 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 24 38 4c 3a
[3372] fAuthSuccess 1d
[3372] WaitForSingleObject Failed
[3372] 0: Close Connection

Ron
January 30th, 2006, 05:47 PM
...

Rob H
January 30th, 2006, 05:49 PM
[3156] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[3156] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[3156] length: 16, data=2d 0c 00 00 08 00 00 00 e2 9f 00 00 f9 f7 0c ee
[3156] length: 23, data=2e 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 d1 d3 e5 48
[3156] fAuthSuccess 1e
[3156] WaitForSingleObject Failed
[3156] 0: Close Connection

Ron
January 30th, 2006, 05:52 PM
mind boggeling.

Rob H
January 30th, 2006, 05:55 PM
[1560] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[1560] length: 16, data=4a 0c 00 00 08 00 00 00 38 19 00 00 b6 7a fd d3
[1560] length: 23, data=4b 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 55 41 40 a2
[1560] fAuthSuccess 1e
[1560] WaitForSingleObject Failed
[1560] 0: Close Connection

Ron
January 30th, 2006, 06:03 PM
That I do not understand. Did it sometimes work?

For some reason two virtual functions are not being called... Is this a known issue with Windows? Anyway I have made them pure virtual in the base class,.. so now there should be no abiguity on what function must be called, please try in a separate directory, make sure you get both files from the zip.

Rob H
January 30th, 2006, 06:15 PM
Actually, I think you zipped up the wrong file previously since that one was dated the 24th not the 30th

Rob H
January 30th, 2006, 06:18 PM
The new one gives a runtime error R6025 - pure virtual function call - no address given though.

This was on the 4th attempt

here's the log for the previous successful attempt as well as the failure


[404] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[404] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[404] length: 16, data=52 0c 00 00 08 00 00 00 d0 81 00 00 9d ce cb 08
[404] length: 23, data=53 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 0d 86 24 53
[404] 0: Outgoing Connection Authenticated
[404] fAuthSuccess 1e
[404] ConnectEvent! 10-18-0-(null)
[404] Sent: 2
[404] length: 20, data=54 0c 00 00 02 00 00 00 02 00 00 00 01 00 00 00 db 31 c5 65
[404] ACK received: 2
[404] 0: Close Connection
[1000] Loading C:\Program Files\Promixis\Girder\temp\comserverlib.dll at Base Address 0x7E920000
[1000] ENHDLG: Process Hooked: C:\Program Files\Promixis\Girder\temp\csevent.exe
[1000] length: 16, data=55 0c 00 00 08 00 00 00 8a 7a 00 00 cb c1 b2 cc
[1000] length: 23, data=56 0c 00 00 06 00 00 00 07 00 00 00 47 49 52 44 45 52 00 30 2f 51 71
[1000] WaitForSingleObject Failed
[1000] 2: CRC Failure
[1000] length: 12, data=ff ff ff ff 00 00 00 00 59 bb 04 69

Ron
January 30th, 2006, 06:19 PM
I think I know what is happening. I might be doing all this during the constructor, which is a no-no when it comes to virtual functions.... hang on.

Ron
January 30th, 2006, 06:42 PM
Actually I was not doing this in the constructor, BUT the thread that was spawned by the constructor would start doing it's thing before the constructor (and thus the virtual function setup) was finished.

Please try this one, again keep it in a separate dir as the comserv plugin will not work with this library.

Rob H
January 30th, 2006, 06:46 PM
No failures after 700+ iterations - looks like you might have cracked it.

Ron
January 30th, 2006, 06:47 PM
Awesome!!!!! :D

Thanks for helping out Rob.

Rob H
January 30th, 2006, 06:48 PM
Not a problem - although to be sure we might want a version that doesn't have all the debug info.

Ron
January 30th, 2006, 06:51 PM
No worries I am cleaning things up right now.

Rob H
January 30th, 2006, 07:03 PM
I'll have to test it tomorrow then. It's gone 1AM here.

Ron
January 30th, 2006, 07:14 PM
How about this one.

Ron
January 30th, 2006, 07:15 PM
Thanks Rob!

Rob H
January 31st, 2006, 03:08 AM
1500+ iterations with no failures

Although that was using the original ComSvr.dll from G4.0.2 - the one in that zip doesn't seem to be compatible

Ron
January 31st, 2006, 10:31 AM
Great. To use the new comserv.dll you'll also need to replace the comserverlib.dll as well. Is that what was incompatible?

Rob H
January 31st, 2006, 11:23 AM
Yes, that was it.

4000+ iterations

However another attempt and I had another blue screen - same stop error (0x0000008E) as before. Normally this machine is quite stable.

Ron
January 31st, 2006, 11:25 AM
XP?

Rob H
January 31st, 2006, 11:39 AM
Yes with SP2

Ron
January 31st, 2006, 11:41 AM
and you are talking about a BSOD?

Ron
January 31st, 2006, 11:43 AM
http://forum.networktechs.com/archive/topic.php/t-77521.html

Rob H
January 31st, 2006, 01:17 PM
It's possible I guess, but this has been the only thing to have triggered it (twice now)

I'll keep an eye on it though.

nurowolf
February 2nd, 2006, 10:58 PM
Hey Ron & Rob

Back from the US Yesterday

Have downloaded the Comserver files that you have uploaded on this thread.

So far every thing seems to be working. Also I have not received any BSOD.

So looks like my HTPC is back in business with reliability.

Thanks for all the hard work guys.

Now I turn my attention to NetRemote (Man this HTPC stuff never ends, my wife calls my HTPC "the Other women")


Cheers
Mark

nurowolf
February 2nd, 2006, 11:00 PM
Hey Ron & Rob

Back from the US Yesterday

Have downloaded the Comserver files that you have uploaded on this thread.

So far every thing seems to be working. Also I have not received any BSOD.

So looks like my HTPC is back in business with reliability.

Thanks for all the hard work guys.

Now I turn my attention to NetRemote (Man this HTPC stuff never ends, my wife calls my HTPC "the Other women")


Cheers
Mark

Rob H
February 3rd, 2006, 01:51 AM
Glad it's working now.