epg icon indicating copy to clipboard operation
epg copied to clipboard

Heap Out of Memory with epgshare01.online

Open howudodat opened this issue 8 months ago • 2 comments

Describe your issue

Not sure the cause as I haven't looked at the code, but trying to pull a single channel from epgshare is creating the heap error

hts@tvh:~/epg$ npm run grab --- --channels=mychannels.xml 

> grab
> npx tsx scripts/commands/epg/grab.ts --channels=mychannels.xml

starting...
config:
  output: guide.xml
  maxConnections: 1
  gzip: false
  channels: mychannels.xml
loading channels...
  found 1 channel(s)
run:

<--- Last few GCs --->

[1951:0x1f1788a0]    22645 ms: Mark-sweep (reduce) 2047.7 (2064.2) -> 2047.3 (2063.0) MB, 55.3 / 0.0 ms  (+ 115.5 ms in 25 steps since start of marking, biggest step 7.4 ms, walltime since start of marking 190 ms) (average mu = 0.380, current mu = 0.358) 

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb9bbf0 node::Abort() [/usr/bin/node]
 2: 0xaa27ee  [/usr/bin/node]
 3: 0xd734a0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0xd73847 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0xf50c55  [/usr/bin/node]
 6: 0xf6312d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 7: 0xf3d81e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 8: 0xf3ebe7 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 9: 0xf1fdea v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
10: 0x12e505f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
11: 0x1711cb9  [/usr/bin/node]

and mychannesl.xml:

<?xml version="1.0" encoding="UTF-8"?>
<channels>
  <channel site="epgshare01.online" lang="en" xmltv_id="" site_id="US_LOCALS2#Bounce.TV.us">Bounce TV</channel>
</channels>

howudodat avatar May 16 '25 19:05 howudodat

Try increasing the RAM limit as indicated in the docs:

NODE_OPTIONS=--max-old-space-size=5000 npm run grab --- --channels=sites/epgshare01.online/epgshare01.online_<TAG>.channels.xml

https://github.com/iptv-org/epg/blob/master/sites/epgshare01.online/readme.md#download-the-guide

freearhey avatar May 17 '25 07:05 freearhey

I had already bumped the memory to 2G, 5G made no difference (you can see that in the GC line). Same error. The problem appears to be with US_LOCALS2

[4870:0x355318a0]   119638 ms: Mark-sweep 4946.0 (5038.1) -> 4931.1 (5039.3) MB, 1254.3 / 0.0 ms  (average mu = 0.099, current mu = 0.042) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb9bbf0 node::Abort() [/usr/bin/node]
 2: 0xaa27ee  [/usr/bin/node]
...
<?xml version="1.0" encoding="UTF-8"?>
<channels>
  <channel site="epgshare01.online" lang="en" xmltv_id="" site_id="US_LOCALS2#Bounce.TV.us">Bounce TV</channel>
</channels>

also tried this one:

<?xml version="1.0" encoding="UTF-8"?>
<channels>
  <channel site="epgshare01.online" lang="en" xmltv_id="" site_id="US_LOCALS2#Grit.TV.us">Grit TV</channel>
</channels>

howudodat avatar May 17 '25 13:05 howudodat

When the memory limit is raised to 6GB, the error disappears:

NODE_OPTIONS=--max-old-space-size=6000 npm run grab --- --channels=sites/epgshare01.online/epgshare01.online_US_LOCALS2.channels.xml

> grab
> tsx scripts/commands/epg/grab.ts --channels=sites/epgshare01.online/epgshare01.online_US_LOCALS2.channels.xml

◐ starting...                                                                                                                                                                                         8:49:40 PM
ℹ config:                                                                                                                                                                                            8:49:40 PM
output: guide.xml
maxConnections: 1
gzip: false
channels: sites/epgshare01.online/epgshare01.online_US_LOCALS2.channels.xml
ℹ loading channels...                                                                                                                                                                                8:49:40 PM
ℹ   found 4295 channel(s)                                                                                                                                                                            8:49:40 PM
ℹ run:                                                                                                                                                                                               8:49:40 PM
ℹ   [1/8590] epgshare01.online (en) - US_LOCALS2#3.News.Now.(WCAX-TV6).Burlington,.VT.us - Jul 15, 2025 (35 programs)                                                                                8:51:37 PM
ℹ   [2/8590] epgshare01.online (en) - US_LOCALS2#3.News.Now.(WCAX-TV6).Burlington,.VT.us - Jul 16, 2025 (35 programs)                                                                                8:51:38 PM
ℹ   [3/8590] epgshare01.online (en) - US_LOCALS2#3ABN.Three.Angels.Broadcasting.Network.us - Jul 15, 2025 (42 programs)
...

freearhey avatar Jul 18 '25 22:07 freearhey