Application becomes unresponsive

193 views
Skip to first unread message

Gerculy Robert

unread,
May 2, 2015, 7:28:34 AM5/2/15
to cefs...@googlegroups.com

Hello, I'm working on a Traffic Exchange software for my website using  CEF : 3.2171.2069, Chromium 39.0.2171.95.
For some reason the application becomes unresponsive after 2-3 minutes. The application worked nicely with other frameworks ( Awesomium[huge memory usage], GeckoFx ) but I had to change them because I need some special settings and I couldn't accomplish with those frameworks ( I'm new ) .

My Form1 script : http://pastebin.com/R7udjTcK 

Contains 90% of the program,  I have a second file, IJsDialogHandler, used to block JS Alert ( I tested the app without this file and the program goes crazy.)   Still looking for a solution for POP-UP windows.


  1.         private void Browser_Initializer()
  2.        {
  3.            var settings = new CefSettings();
  4.            var currentDirectory = Directory.GetCurrentDirectory();
  5.            settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
  6.            settings.CefCommandLineArgs.Add("disable-gpu", "1");
  7.            settings.CachePath = @"" + currentDirectory + "cache";
  8.            settings.CachePath = Application.StartupPath;
  9.            settings.CefCommandLineArgs.Add("persist_session_cookies", "1");
  10.            settings.LogSeverity = LogSeverity.Verbose;
  11.            Cef.SetCookiePath(cache_dir, true);
  12.            Cef.Initialize(settings);
  13.  
  14.            var browser = new ChromiumWebBrowser("http://www.nodlweb.com/v2/")
  15.            {
  16.                Dock = DockStyle.Fill
  17.            };
  18.            Controls.Add(browser);
  19.             toolStripContainer2.ContentPanel.Controls.Add(browser);
  20.             browser.JsDialogHandler = new JsDialogHandler();
  21.            Browser = browser;
  22.        }

This code is loaded in public Form1() .
When the traffic exchange is on, I use Browser.Load(WebURL); to update the URL.

I run over the code again and again, but I just can't find what is wrong.
By unresponsive I mean I can't click on any button, the webpage is stuck, but the program is not in NOT RESPONDING state.

Tested on Personal Computer : ( I5 CPU 4x3.1Ghz, 12 GB RAM) - Windows 7
Tested on Personal Computer : ( Intel Dual Core 3 Ghz. 4 GB Ram ) - Windows 8.1
Tested on VPS : Single Core : 2.1 Ghz CPU with 768 MB Ram - Windows Server 2008

Alex Maitland

unread,
May 2, 2015, 11:54:55 PM5/2/15
to cefs...@googlegroups.com
Can you reproduce your problem with https://github.com/cefsharp/CefSharp.MinimalExample?

Gerculy Robert

unread,
May 3, 2015, 2:30:55 PM5/3/15
to cefs...@googlegroups.com
Yes, It's even worst. The app feels like it's running on a machine with 512 MB ram.

Gerculy Robert

unread,
May 3, 2015, 2:45:05 PM5/3/15
to cefs...@googlegroups.com
Actually, the browser is working - even right click ( on old code, show on post, however system buttons are blocked, so is the traffic exchange ( timers ). Similar to a Javascript Alert box ( which blocks any browser - even from closing it ) . but there is not alert box. 

Gerculy Robert

unread,
May 3, 2015, 6:49:22 PM5/3/15
to cefs...@googlegroups.com
Update : I think is not the problem with Cefsharp, I thnink is my MYSQL server, more likely, to many connections.  I attached a console to my app and seems that there is a problem,
Will update.

Alex Maitland

unread,
May 3, 2015, 6:50:34 PM5/3/15
to cefs...@googlegroups.com
Can you push your fork of `MinimalExample so we can see it? Preferably only include code that is relevant to reproducing the problem.

Alex Maitland

unread,
May 3, 2015, 7:41:37 PM5/3/15
to cefs...@googlegroups.com
Ok cool, sounds promising.

Gerculy Robert

unread,
May 4, 2015, 3:50:20 AM5/4/15
to cefs...@googlegroups.com
It works, 
I used resharper to clean a code section and it did a bit wrong. 

Wrong :
MyReader4 = MyCommand4.ExecuteReader();
MyConn4.Open();

Right :
MyConn4.Open();
MyReader4 = MyCommand4.ExecuteReader();

Simple but effective,
-----

I still don't have a solution for POP-Ups, anyone knows a solution for that ? ( How to block them, or take out the whole multi-window thing.
Thanks.

Alex Maitland

unread,
May 4, 2015, 4:35:07 AM5/4/15
to cefs...@googlegroups.com

Gerculy Robert

unread,
May 5, 2015, 3:02:58 AM5/5/15
to cefs...@googlegroups.com
namespace Nodlweb
{
    internal class ILifeSpanHandler
    {

        public bool OnBeforePopup(IWebBrowser browser, string url, ref int x, ref int y, ref int width, ref int height)
        {
            return true;
        }
    }
}

This should block it right ? For some reason it doesn't.

Alex Maitland

unread,
May 5, 2015, 3:45:50 AM5/5/15
to cefs...@googlegroups.com
Assuming it's a popup Window that your trying to block, returning true will cancel it's creation.

For javascript popups it's IJsDialogHandler you need to implement.

https://github.com/cefsharp/CefSharp/blob/master/CefSharp/IJsDialogHandler.cs

Gerculy Robert

unread,
May 5, 2015, 3:52:38 AM5/5/15
to cefs...@googlegroups.com
I got this four : 
        public bool OnJSAlert(IWebBrowser browser, string url, string message)
        {
            return true;
        }

        public bool OnJSConfirm(IWebBrowser browser, string url, string message, out bool retval)
        {
            retval = true;

            return true;
        }

        public bool OnJSPrompt(IWebBrowser browser, string url, string message, string defaultValue, out bool retval, out string result)
        {
            retval = true;
            result = null;

            return true;
        }

        public bool OnJSBeforeUnload(IWebBrowser browser, string message, bool isReload, out bool allowUnload)
        {
            //NOTE: Setting allowUnload to false will cancel the unload request
            allowUnload = true;

            //NOTE: Returning false will trigger the default behaviour, you need to return true to handle yourself.
            return true;
        }

And https://github.com/cefsharp/CefSharp/blob/master/CefSharp/IJsDialogHandler.cs shows nothing else.

Alex Maitland

unread,
May 5, 2015, 4:06:54 AM5/5/15
to cefs...@googlegroups.com

Alex Maitland

unread,
May 5, 2015, 4:08:18 AM5/5/15
to cefs...@googlegroups.com
I created https://github.com/cefsharp/CefSharp/issues/999 if your interested in getting involved with fixing up the implementation.

Gerculy Robert

unread,
May 5, 2015, 4:09:36 AM5/5/15
to cefs...@googlegroups.com
Thank you. I will look into tonight. 

--
You received this message because you are subscribed to a topic in the Google Groups "CefSharp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cefsharp/r2YBkLDNnbc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cefsharp+u...@googlegroups.com.
To post to this group, send email to cefs...@googlegroups.com.
Visit this group at http://groups.google.com/group/cefsharp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages