[go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread peterGo
qiulaidongfeng,

A simpler, solution:

https://go.dev/play/p/gLY7O_hwyxI

peter

On Saturday, March 2, 2024 at 8:25:33 PM UTC-5 qiulaidongfeng wrote:

> I wrote a correct one, as shown here:
> https://go.dev/play/p/IDJP_iIsGDE
>
> On Sunday, March 3, 2024 at 1:42:51 AM UTC+8 BUGFIX 66 wrote:
>
>> https://BUGFIX-66.com
>>
>> Solve each puzzle by making a tiny change to a short piece of Go code.
>> Edited code is compiled and tested on the host server.
>> Each puzzle is a useful little algorithm or idea.
>> Unfortunately, most users can't solve puzzle #3 and give up.
>> Enjoy.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1f2d2c9b-0b07-4030-8f49-37f22210be8en%40googlegroups.com.


[go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread 'qiulaidongfeng' via golang-nuts
I wrote a correct one, as shown here:
https://go.dev/play/p/IDJP_iIsGDE

On Sunday, March 3, 2024 at 1:42:51 AM UTC+8 BUGFIX 66 wrote:

> https://BUGFIX-66.com
>
> Solve each puzzle by making a tiny change to a short piece of Go code.
> Edited code is compiled and tested on the host server.
> Each puzzle is a useful little algorithm or idea.
> Unfortunately, most users can't solve puzzle #3 and give up.
> Enjoy.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7f5466f1-6e06-43e1-84c1-a229cc2e8505n%40googlegroups.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
Glad you figured it out. Not certain how requests could crash a process like… I think you’d be better off configuring a maximum heap size rather than having the OOM killer kick in On Mar 2, 2024, at 3:50 PM, Russtopia  wrote:SOLVED!Thank you all for the helpful suggestions. Although it has turned out to be something totally different, and a teachable lesson in web app design...This go tool of mine has a very simple web interface with controls for a set of jobs on the main page.The jobs on this list can be run, viewed, and most importantly, cancelled via an endpoint of the form "/cancel/?id=nnn" ...I have had the site up in a "demo" mode on the public internet at various times, including recently -- it turns out that very recently some crawl bots must have found it, and they are following those /cancel/ links on the dashboard almost as soon as they appear -- they must be scanning at <5sec intervals to find the new unique jobIDs encoded in each 'cancel' link. Oops :)The app's usually behind an auth page, but this time it wasn't. I'm not a web dev so rookie mistake I suppose!I guess I really should have a 'robots.txt' file served out by my go app to prevent this, and perhaps consider other client session ids to prevent outside crawlers from accidentally activating my app's link endpoints.Thank you again, all.On Sat, Mar 2, 2024 at 6:23 PM Robert Engels  wrote:I would  be also try reverting the Go version and ensure that it continues to work. Other system libraries may have been updated. 

> On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> 
> On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>> 
>> Symptom: mysterious "signal: killed" occurrences with processes spawned from Go via exec.Cmd.Start()/Wait()
> 
> The first step is to tell us the exact and complete error that you
> see.  "signal: killed" can have different causes, and the rest of the
> information should help determine what is causing this one.
> 
> Ian
> 
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com.





-- 
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/852FA6F1-8B90-4361-B1BC-579FBEC83513%40ix.netcom.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
SOLVED!

Thank you all for the helpful suggestions. Although it has turned out to be
something totally different, and a teachable lesson in web app design...

This go tool of mine has a very simple web interface with controls for a
set of jobs on the main page.
The jobs on this list can be run, viewed, and most importantly, cancelled
via an endpoint of the form "/cancel/?id=nnn" ...
I have had the site up in a "demo" mode on the public internet at various
times, including recently -- it turns out that very recently some crawl
bots must have found it, and they are following those /cancel/ links on the
dashboard almost as soon as they appear -- they must be scanning at <5sec
intervals to find the new unique jobIDs encoded in each 'cancel' link. Oops
:)

The app's usually behind an auth page, but this time it wasn't. I'm not a
web dev so rookie mistake I suppose!
I guess I really should have a 'robots.txt' file served out by my go app to
prevent this, and perhaps consider other client session ids to prevent
outside crawlers from accidentally activating my app's link endpoints.

Thank you again, all.

On Sat, Mar 2, 2024 at 6:23 PM Robert Engels  wrote:

> I would  be also try reverting the Go version and ensure that it continues
> to work. Other system libraries may have been updated.
>
> > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> >
> > On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
> >>
> >> Symptom: mysterious "signal: killed" occurrences with processes spawned
> from Go via exec.Cmd.Start()/Wait()
> >
> > The first step is to tell us the exact and complete error that you
> > see.  "signal: killed" can have different causes, and the rest of the
> > information should help determine what is causing this one.
> >
> > Ian
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu8DRA-iPvuC_r4ToGAoADRG_ejYBCTVQ060O0tSK1rESA%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Kurtis Rader
My recommendation is run your program under the control of `strace`. The
simplest way to do that is to rename the current program you're launching
by adding something like a ".orig" extension. Then create a script with the
name of the program containing this:

#!/bin/sh
exec strace -o /tmp/strace.out -t /path/to/prog.orig

On Sat, Mar 2, 2024 at 11:58 AM Russtopia  wrote:

> It no longer does.. so it suggests to me there's something external that
> has changed, but I have no clue as to what that might be -- as the process
> being started by my go tool will run just fine from a shell. And, it *does*
> run fine on my laptop (which granted is beefier, but again this server was
> running the tool just fine for years and I haven't done any big upgrades,
> but it *is* possible some minor underlying package update has severely
> changed the environment somehow). Unfortunately I don't have a system-wide
> 'snapshot' I can revert to.
>
> Perhaps this will end up being a question of Linux diagnostics more than
> Go but I haven't yet seen any way to tell *why* the process is being
> killed, whether it be due to some bug tickled by Go's exec or something
> else. The oom_reaper doesn't say a thing to system logs; I don't see my
> free RAM or swap suddenly drop.. I've even checked my server for rootkits
> out of paranoia :). Everything else on the system is just fine, I just
> cannot seem to run these scripts any more when launched from my go program
> (again, even a 'do-nothing' script that just sleeps a few times, then
> completes with exit status 0, no longer works -- it just gets 'killed').
>
>
> On Sat, Mar 2, 2024 at 7:39 PM Robert Engels 
> wrote:
>
>> Please clarify - does it work using the older versions of Go?
>>
>> On Mar 2, 2024, at 12:53 PM, Russtopia  wrote:
>>
>> 
>> I have tried rebuilding with go1.18.6, go1.15.15 with no difference.
>>
>> On Sat, Mar 2, 2024 at 6:23 PM Robert Engels 
>> wrote:
>>
>>> I would  be also try reverting the Go version and ensure that it
>>> continues to work. Other system libraries may have been updated.
>>>
>>> > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
>>> >
>>> > On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>>> >>
>>> >> Symptom: mysterious "signal: killed" occurrences with processes
>>> spawned from Go via exec.Cmd.Start()/Wait()
>>> >
>>> > The first step is to tell us the exact and complete error that you
>>> > see.  "signal: killed" can have different causes, and the rest of the
>>> > information should help determine what is causing this one.
>>> >
>>> > Ian
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts+unsubscr...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAN4yCu-3VDej9EGtQ%3D6wcrU0fi5T67R5et%2BbVek10XHyXNngYg%40mail.gmail.com
> 
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-OgSuHWspOjgLSLSsgsm36f6yX30uTNqZijsnJ%3D4xpKg%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
I’m guessing some other library or package you installed has corrupted your Linux installation. Sadly, my suggestion would be a fresh install of Linux. On Mar 2, 2024, at 1:58 PM, Russtopia  wrote:It no longer does.. so it suggests to me there's something external that has changed, but I have no clue as to what that might be -- as the process being started by my go tool will run just fine from a shell. And, it *does* run fine on my laptop (which granted is beefier, but again this server was running the tool just fine for years and I haven't done any big upgrades, but it *is* possible some minor underlying package update has severely changed the environment somehow). Unfortunately I don't have a system-wide 'snapshot' I can revert to.Perhaps this will end up being a question of Linux diagnostics more than Go but I haven't yet seen any way to tell *why* the process is being killed, whether it be due to some bug tickled by Go's exec or something else. The oom_reaper doesn't say a thing to system logs; I don't see my free RAM or swap suddenly drop.. I've even checked my server for rootkits out of paranoia :). Everything else on the system is just fine, I just cannot seem to run these scripts any more when launched from my go program (again, even a 'do-nothing' script that just sleeps a few times, then completes with exit status 0, no longer works -- it just gets 'killed').On Sat, Mar 2, 2024 at 7:39 PM Robert Engels  wrote:Please clarify - does it work using the older versions of Go?On Mar 2, 2024, at 12:53 PM, Russtopia  wrote:I have tried rebuilding with go1.18.6, go1.15.15 with no difference.On Sat, Mar 2, 2024 at 6:23 PM Robert Engels  wrote:I would  be also try reverting the Go version and ensure that it continues to work. Other system libraries may have been updated. 

> On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> 
> On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>> 
>> Symptom: mysterious "signal: killed" occurrences with processes spawned from Go via exec.Cmd.Start()/Wait()
> 
> The first step is to tell us the exact and complete error that you
> see.  "signal: killed" can have different causes, and the rest of the
> information should help determine what is causing this one.
> 
> Ian
> 
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com.






-- 
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/B6BF9BE3-1A33-4B05-92C2-1382B6F845CF%40ix.netcom.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
.. I should add that I have often completely restarted the go program
during testing here, so I don't think it could be a case of some long-term
'leak' in the go tool's own code since it's been relaunched and doesn't
have any big 'state' to restore or anything.

On Sat, Mar 2, 2024 at 7:57 PM Russtopia  wrote:

> It no longer does.. so it suggests to me there's something external that
> has changed, but I have no clue as to what that might be -- as the process
> being started by my go tool will run just fine from a shell. And, it *does*
> run fine on my laptop (which granted is beefier, but again this server was
> running the tool just fine for years and I haven't done any big upgrades,
> but it *is* possible some minor underlying package update has severely
> changed the environment somehow). Unfortunately I don't have a system-wide
> 'snapshot' I can revert to.
>
> Perhaps this will end up being a question of Linux diagnostics more than
> Go but I haven't yet seen any way to tell *why* the process is being
> killed, whether it be due to some bug tickled by Go's exec or something
> else. The oom_reaper doesn't say a thing to system logs; I don't see my
> free RAM or swap suddenly drop.. I've even checked my server for rootkits
> out of paranoia :). Everything else on the system is just fine, I just
> cannot seem to run these scripts any more when launched from my go program
> (again, even a 'do-nothing' script that just sleeps a few times, then
> completes with exit status 0, no longer works -- it just gets 'killed').
>
>
> On Sat, Mar 2, 2024 at 7:39 PM Robert Engels 
> wrote:
>
>> Please clarify - does it work using the older versions of Go?
>>
>> On Mar 2, 2024, at 12:53 PM, Russtopia  wrote:
>>
>> 
>> I have tried rebuilding with go1.18.6, go1.15.15 with no difference.
>>
>> On Sat, Mar 2, 2024 at 6:23 PM Robert Engels 
>> wrote:
>>
>>> I would  be also try reverting the Go version and ensure that it
>>> continues to work. Other system libraries may have been updated.
>>>
>>> > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
>>> >
>>> > On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>>> >>
>>> >> Symptom: mysterious "signal: killed" occurrences with processes
>>> spawned from Go via exec.Cmd.Start()/Wait()
>>> >
>>> > The first step is to tell us the exact and complete error that you
>>> > see.  "signal: killed" can have different causes, and the rest of the
>>> > information should help determine what is causing this one.
>>> >
>>> > Ian
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts+unsubscr...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu_ZdjevdFUiMbCtmHk44rEi-zHeye4L-mTe11TT8G2eNg%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
It no longer does.. so it suggests to me there's something external that
has changed, but I have no clue as to what that might be -- as the process
being started by my go tool will run just fine from a shell. And, it *does*
run fine on my laptop (which granted is beefier, but again this server was
running the tool just fine for years and I haven't done any big upgrades,
but it *is* possible some minor underlying package update has severely
changed the environment somehow). Unfortunately I don't have a system-wide
'snapshot' I can revert to.

Perhaps this will end up being a question of Linux diagnostics more than Go
but I haven't yet seen any way to tell *why* the process is being killed,
whether it be due to some bug tickled by Go's exec or something else. The
oom_reaper doesn't say a thing to system logs; I don't see my free RAM or
swap suddenly drop.. I've even checked my server for rootkits out of
paranoia :). Everything else on the system is just fine, I just cannot seem
to run these scripts any more when launched from my go program (again, even
a 'do-nothing' script that just sleeps a few times, then completes with
exit status 0, no longer works -- it just gets 'killed').


On Sat, Mar 2, 2024 at 7:39 PM Robert Engels  wrote:

> Please clarify - does it work using the older versions of Go?
>
> On Mar 2, 2024, at 12:53 PM, Russtopia  wrote:
>
> 
> I have tried rebuilding with go1.18.6, go1.15.15 with no difference.
>
> On Sat, Mar 2, 2024 at 6:23 PM Robert Engels 
> wrote:
>
>> I would  be also try reverting the Go version and ensure that it
>> continues to work. Other system libraries may have been updated.
>>
>> > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
>> >
>> > On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>> >>
>> >> Symptom: mysterious "signal: killed" occurrences with processes
>> spawned from Go via exec.Cmd.Start()/Wait()
>> >
>> > The first step is to tell us the exact and complete error that you
>> > see.  "signal: killed" can have different causes, and the rest of the
>> > information should help determine what is causing this one.
>> >
>> > Ian
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "golang-nuts" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to golang-nuts+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu-3VDej9EGtQ%3D6wcrU0fi5T67R5et%2BbVek10XHyXNngYg%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
Please clarify - does it work using the older versions of Go?On Mar 2, 2024, at 12:53 PM, Russtopia  wrote:I have tried rebuilding with go1.18.6, go1.15.15 with no difference.On Sat, Mar 2, 2024 at 6:23 PM Robert Engels  wrote:I would  be also try reverting the Go version and ensure that it continues to work. Other system libraries may have been updated. 

> On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> 
> On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>> 
>> Symptom: mysterious "signal: killed" occurrences with processes spawned from Go via exec.Cmd.Start()/Wait()
> 
> The first step is to tell us the exact and complete error that you
> see.  "signal: killed" can have different causes, and the rest of the
> information should help determine what is causing this one.
> 
> Ian
> 
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com.





-- 
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8E4E2802-8E23-4427-ACA1-DBA30EBD8B30%40ix.netcom.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
I have tried rebuilding with go1.18.6, go1.15.15 with no difference.

On Sat, Mar 2, 2024 at 6:23 PM Robert Engels  wrote:

> I would  be also try reverting the Go version and ensure that it continues
> to work. Other system libraries may have been updated.
>
> > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> >
> > On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
> >>
> >> Symptom: mysterious "signal: killed" occurrences with processes spawned
> from Go via exec.Cmd.Start()/Wait()
> >
> > The first step is to tell us the exact and complete error that you
> > see.  "signal: killed" can have different causes, and the rest of the
> > information should help determine what is causing this one.
> >
> > Ian
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu_btPr9-PntaH6Vq7Uf4%3D%3DNnd%2B20MJUktXhBq14ZzEPdw%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
Hi, I tried outputting the value of werr.(*exec.ExitError).Stderr, but it's
empty.

Outputting all of werr.(*exec.ExitError) via

fmt.Printf("[job *ExitError:%+v]\n", werr.(*exec.ExitError))

..gives merely

[job *ExitError:signal: killed]



On Sat, Mar 2, 2024 at 6:04 PM Ian Lance Taylor  wrote:

> On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
> >
> > Symptom: mysterious "signal: killed" occurrences with processes spawned
> from Go via exec.Cmd.Start()/Wait()
>
> The first step is to tell us the exact and complete error that you
> see.  "signal: killed" can have different causes, and the rest of the
> information should help determine what is causing this one.
>
> Ian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu_QqCHMuZnCkc%3DoH7e5uJLS4mfcK5zSa15ehzFUeUn2BQ%40mail.gmail.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
I would  be also try reverting the Go version and ensure that it continues to 
work. Other system libraries may have been updated. 

> On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor  wrote:
> 
> On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>> 
>> Symptom: mysterious "signal: killed" occurrences with processes spawned from 
>> Go via exec.Cmd.Start()/Wait()
> 
> The first step is to tell us the exact and complete error that you
> see.  "signal: killed" can have different causes, and the rest of the
> information should help determine what is causing this one.
> 
> Ian
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/B3E066FF-18F8-4BD9-A78B-2D98B930801B%40ix.netcom.com.


Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Ian Lance Taylor
On Sat, Mar 2, 2024 at 9:59 AM Russtopia  wrote:
>
> Symptom: mysterious "signal: killed" occurrences with processes spawned from 
> Go via exec.Cmd.Start()/Wait()

The first step is to tell us the exact and complete error that you
see.  "signal: killed" can have different causes, and the rest of the
information should help determine what is causing this one.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR6hBSnGLjehwng%2BXp4QQ8ZznramEAZTmD%3D6tVwFirTg%40mail.gmail.com.


[go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
Hi all,

Symptom: mysterious "signal: killed" occurrences with processes spawned
from Go via exec.Cmd.Start()/Wait()

Actors:

'Server': Intel i5, running Funtoo 1.4 - 4GB RAM, 4GB swap
'Laptop': Intel Core i7 9thGen, running Devuan Chimaera - 15GB RAm, 15GB
swap

A quite small -- ~900 lines of code in two .go files, program I developed
which has been running for years just fine on 'Server', which spawns and
monitors other programs using exec.Cmd.Start() and then uses
exec.Cmd.Wait() to monitor them, started acting very strangely a few days
ago, after either: upgrading from go 1.18 to go 1.22 (amd64), and/or non-
Go related minor updates (regretfully I don't recall exactly what, but it
was not a distro or kernel upgrade, nor a major version of glibc or
anything like that).

What used to be smoothly launched tasks from my Go program became
erratically (then almost always) aborted jobs, with the status of "signal:
killed". I can watch the system with 'top or 'htop' and don't see any
obvious spikes in mem or CPU usage, and never have with this setup
beforehand either.

I spent a few evenings verifying 'Server' wasn't out of memory
(oom_reaper), as many web searches suggest is the biggest cause of the
above, and other system-related things with no luck (no oom logs in
/var/log/kern.log, dmesg, etc.).

I even tried launching my go program with some of the debug options
mentioned here, but didn't see anything unusual:

https://github.com/golang/go/issues/31517

Everything else on 'Server' ran fine, so I began to suspect the
unthinkable: could the new Go toolchain 1.22.0 I installed have some subtle
issue with the server's runtime environment, or could there be a compiler
bug?

Out of habit, after any go update I usually rebuild this project using the
new toolchain, which I believe I had done just before this issue began; so
first I reverted to go1.18 on 'Server' (there as a fallback), and rebuilt
my tool; no help. I tried clearing out all of ~/go/pkg/mod/* and refetched
all dependencies, rebuilt again. Still no help.

Then I tried building the project on another machine, 'Laptop', which had
go1.21.0; on this machine it ran fine. So I copied *that* build of the tool
back to 'Server', and it failed with "sign: killed" as well.

I tried the reverse ('Server' build of project, using go1.22.0 copied to
'Laptop' using go1.18.x) but that failed, as there was a GLIBC
incompatibility preventing it running. (I think Funtoo had a slightly newer
GLIBC version than Devuan).

Anyhow, in case it *was* a go toolchain or C library issue beneath Go
itself, I downloaded the latest go 1.22.0 source to 'Server' and rebuilt it
there from scratch (all.bash); using that to rebuild my tool I was happy to
see it now worked normally again... for about 5 rounds of spawning
programs, then the issue returned!

The 'Server' isn't very powerful, but it's definitely not out of memory and
has run my tool reliably for a long time, until the last week:

$ free
   totalusedfree  shared  buff/cache
available
Mem: 3928680 1334988  592232   29368 2001460
2277376
Swap:4194300  136192 4058108

This issue even occurs spawning a simple 'do-nothing' shell script, which
just loops sleeping for 5 seconds a few times before exiting. These
processes/scripts run perfectly from the shell command line, without using
my Go program to launch them.

What the heck is going on? How do I diagnose this?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN4yCu8Knootg-4%3DNS_EPzLKssg18Lv4f6QZ%2B16-gMBB-kaHSw%40mail.gmail.com.


[go-nuts] c-shared library for Aix

2024-03-02 Thread Anshuman Mor
I have written multiple c-shared libraries code in golang for Windows, 
Linux, MacOS . I am using GCC cross compiler for the same. This code is 
running fine in production without any issue since last 3 years.

But, we have recently got a requirement to compile the same thing for 
AIX/PowerPC but I am afraid that go compiler doesn't support this out of 
the box, I tried many approaches but none worked like - 

1. Using gccgo compiler but this errors out with "Thread Local Storage" 
error.
2. Using c-archive and then convert to shared using gcc compiler, this also 
errors out with something or other.

Has anyone done similar type of work for Aix? Any help would be greatly 
appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/de83013b-cf5e-4661-90c3-5c6c05405641n%40googlegroups.com.


[go-nuts] 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread BUGFIX 66
https://BUGFIX-66.com

Solve each puzzle by making a tiny change to a short piece of Go code.
Edited code is compiled and tested on the host server.
Each puzzle is a useful little algorithm or idea.
Unfortunately, most users can't solve puzzle #3 and give up.
Enjoy.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b78b1c87-bb98-4f7f-94e8-71e7d335abben%40googlegroups.com.