jnonline / ogstudio

Automatically exported from code.google.com/p/ogstudio
0 stars 0 forks source link

Find out why OGS Mahjong 1.0.6 fails to start online scored game at Kai's laptop #670

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This began after adding DNS lookup.
I need to add extensive logging to:
* main timer to find out if the app hangs;
* DNS and Net work to find out what happens there.
I need to also be able to disable DNS lookup selectively and to set timeout 
value from config.

Original issue reported on code.google.com by korn...@gmail.com on 16 Jul 2013 at 2:30

GoogleCodeExporter commented 9 years ago
Also, have a look at diff between 1.0.5 and 1.0.6

Original comment by korn...@gmail.com on 16 Jul 2013 at 2:46

GoogleCodeExporter commented 9 years ago

Original comment by Kai.Saerthen.Darker on 16 Jul 2013 at 5:24

GoogleCodeExporter commented 9 years ago
Print timer only once in a while, not every tick.

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:13

GoogleCodeExporter commented 9 years ago
Done printing once in 50 ticks.

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:23

GoogleCodeExporter commented 9 years ago
Print DNS work.

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:24

GoogleCodeExporter commented 9 years ago
Added printing, but need to add pointer to tell instances apart.

Original comment by korn...@gmail.com on 18 Jul 2013 at 6:17

GoogleCodeExporter commented 9 years ago
Addresses of instances printed.

Original comment by korn...@gmail.com on 18 Jul 2013 at 10:08

GoogleCodeExporter commented 9 years ago
Clarify Net message and add logging of Done/Error signals.

Original comment by korn...@gmail.com on 18 Jul 2013 at 10:18

GoogleCodeExporter commented 9 years ago
To both Net and NetDNS.

Original comment by korn...@gmail.com on 18 Jul 2013 at 10:18

GoogleCodeExporter commented 9 years ago
Did it.

Original comment by korn...@gmail.com on 18 Jul 2013 at 11:45

GoogleCodeExporter commented 9 years ago
Left:
* turn on/off DNS lookup in config;
* set timeouts for DNS lookup and get/post separately in config.

Original comment by korn...@gmail.com on 18 Jul 2013 at 11:46

GoogleCodeExporter commented 9 years ago
MainCore and Statistics create Net instances.

Original comment by korn...@gmail.com on 18 Jul 2013 at 11:49

GoogleCodeExporter commented 9 years ago
Pass Net instance from MainCore to Statistics.

Original comment by korn...@gmail.com on 18 Jul 2013 at 1:33

GoogleCodeExporter commented 9 years ago
Did it.
Create Net constructor:
* turn on/off DNS lookup;
* timeouts for DNS and get/post separately.

Original comment by korn...@gmail.com on 18 Jul 2013 at 1:45

GoogleCodeExporter commented 9 years ago
Net constructor now accepts a flag to use DNS lookup or not.
I won't do separate timeout configuration, because that breaks the structure 
too much.
Now introduce the following config options:
* NetDNSEnabled;
* NetTimeout.

Original comment by korn...@gmail.com on 18 Jul 2013 at 1:56

GoogleCodeExporter commented 9 years ago
Did it.

Time to build 1.0.7 and describe NetDNSEnabled and NetTimeout options.

Original comment by korn...@gmail.com on 18 Jul 2013 at 2:22

GoogleCodeExporter commented 9 years ago
Build OGS Mahjong 1.0.7 in Issue 671 and then assign this issue to Kai for 
further investigation.

Original comment by korn...@gmail.com on 18 Jul 2013 at 2:27

GoogleCodeExporter commented 9 years ago

Original comment by korn...@gmail.com on 18 Jul 2013 at 2:27

GoogleCodeExporter commented 9 years ago
The 1.0.6 with Net logging for Windows is available at: 
http://sourceforge.net/projects/osrpgcreation/files/Mahjong/dev/windows32.7z

* game.cfg:
** NetDNSEnabled = 0|1 (enables or disables the use of c-ares for DNS lookup);
** NetTimeout = N (sets N/2 timeout for DNS lookup and N/2 timeout for 
get/post).

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:01

GoogleCodeExporter commented 9 years ago
Crashes for me under Windows at setScene(Room).

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:10

GoogleCodeExporter commented 9 years ago
Right before the first NetDNSLookup print.

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:11

GoogleCodeExporter commented 9 years ago
Add prints to each step.

Original comment by korn...@gmail.com on 18 Jul 2013 at 4:17

GoogleCodeExporter commented 9 years ago
Btw, I can also try to see Net and NetDNS tests right under Windows in VM.

Original comment by korn...@gmail.com on 19 Jul 2013 at 3:47

GoogleCodeExporter commented 9 years ago
Test fails due to added MJIN_LOG: it requires Log being created beforehand.

Original comment by korn...@gmail.com on 19 Jul 2013 at 3:51

GoogleCodeExporter commented 9 years ago
Fixed it. Fails under Windows due to uninitialized c-ares. Investigate.

Original comment by korn...@gmail.com on 19 Jul 2013 at 3:55

GoogleCodeExporter commented 9 years ago
That's because init happens in mjin::Application which is unnecessary for the 
test.
Introduce NetDNSLookup::initLibrary and use it in mjin::Application and the 
test.

Original comment by korn...@gmail.com on 19 Jul 2013 at 5:03

GoogleCodeExporter commented 9 years ago
Still crashes under Windows. Right before logging.

Original comment by korn...@gmail.com on 19 Jul 2013 at 5:19

GoogleCodeExporter commented 9 years ago
It's not logging, looks like it's address printing with MJIN_STR!

Original comment by korn...@gmail.com on 19 Jul 2013 at 6:13

GoogleCodeExporter commented 9 years ago
Fixed it with '%p' instead of '%llu'.
DNS works fine under both Windows and Linux now.
testNet doesn't work. Fix it.

Original comment by korn...@gmail.com on 19 Jul 2013 at 6:24

GoogleCodeExporter commented 9 years ago
Somehow testNet runs STAGE_GET_VALID_HOST two times. And the second one fails. 
It should run it second time at all.

Original comment by korn...@gmail.com on 20 Jul 2013 at 12:37

GoogleCodeExporter commented 9 years ago
That's because timeout = 0 and it fails right away. Timeout = 0 should actually 
mean 'indefinite'.

Original comment by korn...@gmail.com on 20 Jul 2013 at 12:47

GoogleCodeExporter commented 9 years ago
Did it. Now it stops at SLOW_HOST stage.

Original comment by korn...@gmail.com on 20 Jul 2013 at 12:59

GoogleCodeExporter commented 9 years ago
DNS reports 'Domain name not found' for IP address. Hm.

Original comment by korn...@gmail.com on 20 Jul 2013 at 1:04

GoogleCodeExporter commented 9 years ago
* Why isn't error going to Net?
* Do not resolve IP addresses.

Original comment by korn...@gmail.com on 20 Jul 2013 at 1:07

GoogleCodeExporter commented 9 years ago
It's not going, because we start to use NetDNSLookup before the tick ends.
Figure out how to fix the overlap.

Original comment by korn...@gmail.com on 20 Jul 2013 at 1:44

GoogleCodeExporter commented 9 years ago
Try just to move the things located below ares_process higher before the call?

Original comment by korn...@gmail.com on 22 Jul 2013 at 5:14

GoogleCodeExporter commented 9 years ago
Did it. Looks like dsnCallback is simply never called when we try to resolve IP 
address by name, so testNet simply hangs.

Original comment by korn...@gmail.com on 22 Jul 2013 at 5:26

GoogleCodeExporter commented 9 years ago
Try to use localhost instead of my own IP address.

Original comment by korn...@gmail.com on 22 Jul 2013 at 6:07

GoogleCodeExporter commented 9 years ago
The problem is actually in port specification. IP is resolved OK!

Original comment by korn...@gmail.com on 22 Jul 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Well, then simply use bare IP at 80 port.

Original comment by korn...@gmail.com on 22 Jul 2013 at 7:53

GoogleCodeExporter commented 9 years ago
c-ares fails for several instances.

Original comment by korn...@gmail.com on 22 Jul 2013 at 9:52

GoogleCodeExporter commented 9 years ago
I don't know the reason...

Original comment by korn...@gmail.com on 22 Jul 2013 at 9:54

GoogleCodeExporter commented 9 years ago
Try to run tests under Windows.

Original comment by korn...@gmail.com on 22 Jul 2013 at 10:39

GoogleCodeExporter commented 9 years ago
testNet crashes under Windows at the same stage as under Linux.
Rebuild the game and retry it.

Original comment by korn...@gmail.com on 22 Jul 2013 at 10:52

GoogleCodeExporter commented 9 years ago
It runs! Great. Now build a package.

Original comment by korn...@gmail.com on 22 Jul 2013 at 12:34

GoogleCodeExporter commented 9 years ago
Uploaded as 
http://sourceforge.net/projects/osrpgcreation/files/Mahjong/dev/ogs-mahjong-1.0.
6-windows32-net-logging.7z

Original comment by korn...@gmail.com on 22 Jul 2013 at 3:14

GoogleCodeExporter commented 9 years ago
Here's the log of this 1.0.6.
As i said before, 1.0.5 works fine.

Original comment by Kai.Saerthen.Darker on 22 Jul 2013 at 5:54

Attachments:

GoogleCodeExporter commented 9 years ago
Try to increase timeout with NetTimeout and turn DNS lookup on/off with 
NetDNSEnabled.

Original comment by korn...@gmail.com on 23 Jul 2013 at 2:14

GoogleCodeExporter commented 9 years ago
NetDNSEnabled = 0
Solves the problem.

Setting bigger values for NetTimeout does not.

Still need to find out why it's not able to access DNS, but existing workaround 
is a half way to fixing (or localizing) the problem.

Original comment by Kai.Saerthen.Darker on 24 Jul 2013 at 7:14