server icon indicating copy to clipboard operation
server copied to clipboard

Bug: CEF doesn't load HTTP pages

Open Ghostbird opened this issue 3 months ago • 4 comments

Observed Behavior

CasparCG logs this:

[2025-09-27 11:18:43.588] [trace]   Ready for a new command
[2025-09-27 11:18:52.291] [info]    Received message from 192.168.254.255: PLAY 1-10 [HTML] "http://example.org" CUT 1 Linear RIGHT\r\n
[2025-09-27 11:18:52.292] [debug]   Executing command: PLAY
[2025-09-27 11:18:52.293] [trace]   [cef_task] executing task
[2025-09-27 11:18:52.294] [trace]   [cef_task] task succeeded
[2025-09-27 11:18:52.294] [info]    Sent message to 192.168.254.255:202 PLAY OK\r\n
[2025-09-27 11:18:52.295] [debug]   Executed command (0.003s): PLAY
[2025-09-27 11:18:52.295] [trace]   Ready for a new command

If I enable remote debugging, I see that CEF has instantiated. However nothing is loaded except:

<html><head></head><body></body></html>

If I run in the console:

window.location.href
> 'about:blank'

Expected behaviour

CEF loads the page.

Steps to reproduce

  1. Run CasparCG
  2. Send the ACMP command PLAY 1-10 [HTML] "http://example.org" CUT 1 Linear RIGHT\r\n

Environment

  • Commit: 21e753edec1c3dffab9b0040217426af560cbb67
  • Server version: Latest master
  • Operating system: Debian 13 Trixie GNU/Linux 6.12.43+deb13-amd64
  • Bug happens both when built using system CEF from PPA and when built with -DUSE_SYSTEM_CEF=OFF

NOTE: This includes yesterday's addition that CEF page errors are now correctly logged (which is very nice!) But the error existed before that change.

Ghostbird avatar Sep 27 '25 09:09 Ghostbird

Note: I found out that if you load a template HTML file, you can load a web app using a construct such as this:

<script>
setTimeout(() => fetch(`http://localhost:8080/bundle.js`).then(response => response.text()).then(eval),1000)
</script>

It is interesting to see that a non-negligible timeout is seems necessary to make this work. But that might not be related to this bug, and it might be something confounding that I encountered when experimenting. When doing this I was primarily trying to get something to work before an event, not systematically debugging.

In terms of functionality, that isn't a useful workaround, as the bundle will be built with references to assets and other scripts, that may not resolve correctly when the overarching page is loaded as a local file instead of the intended HTTP server.

I also noted that in these cases web-sockets connections did not work properly, but it may not be related to this issue, simply a symptom of running in a "local file" context, rather than a true "website".

Ghostbird avatar Oct 01 '25 17:10 Ghostbird

I can't reproduce this on ubuntu 24.04, pages happily load normally

Julusian avatar Nov 14 '25 20:11 Julusian

I'll check if I can find anything more. It's on my to-do list. Do you have any suggestions on things to check? I thought it might be some complication related to system libraries, but it's strange that using HTML templates does work without issue, and using fetch from such a template also works. I think that the most suspicious thing is the fact that fetch only works after a minor timeout, in HTML templates, but I haven't managed to draw any conclusions from that yet.

Ghostbird avatar Dec 03 '25 07:12 Ghostbird

No, I have no ideas on why this would be happening.

Could there maybe some kind of firewall/antivirus/something running? Maybe that is resulting in the newly spawned cef processes not being able to do networking?

Does the producer unload when this happens, or does it get stuck? If the latter, maybe a CALL 1-10 RELOAD a few seconds after loading a url could nudge it to life?

Julusian avatar Dec 03 '25 18:12 Julusian