Edouard127 / reddit-placebot-2023

A bot for r/place that doesn't use the api
MIT License
87 stars 15 forks source link

invalid memory address or nil pointer dereference #30

Closed gigantino closed 1 year ago

gigantino commented 1 year ago

Just pulled the last commit. I updated my tor settings in /etc/tor/torrc by adding the following at the end of the (already existing) torrc file:

CircuitBuildTimeout 30
LearnCircuitBuildTimeout 0 
MaxCircuitDirtiness 30

I then built the code using go build . and ran it, and I'm getting the following error:

anic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x79c99a]

goroutine 254 [running]:
main.listenForCircuit(0x79b20a?, 0x0?)
    /home/gigantino/place/reddit-placebot-2023/util.go:98 +0x23a
created by main.(*Client).Setup
    /home/gigantino/place/reddit-placebot-2023/client.go:245 +0x396
Edouard127 commented 1 year ago

So far I'm unable to reproduce, can you replace the line 98 in util.go with fmt.Println(json.NewDecoder(resp.Body).Decode(&newIp))

cereal-kitty commented 1 year ago

yeah i succeeded several times and i was trying to add more accounts then i got the same problem

Edouard127 commented 1 year ago

I was able to reproduce, let me investigate

cereal-kitty commented 1 year ago

now : 2023-07-23T10:28:52.986+0800 INFO reddit-placebot-2023-master/client.go:81 Login successful {"username": "Klutzy-Put-6652"} panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x728cf2]

goroutine 100 [running]: main.listenForCircuit(0x2540be400, 0xa63a140) D:/Desktop2/reddit-placebot-2023-master/util.go:82 +0x102 created by main.(*Client).Setup D:/Desktop2/reddit-placebot-2023-master/client.go:245 +0x363

Process finished with the exit code 2

Edouard127 commented 1 year ago

now : 2023-07-23T10:28:52.986+0800 INFO reddit-placebot-2023-master/client.go:81 Login successful {"username": "Klutzy-Put-6652"} panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x728cf2]

goroutine 100 [running]: main.listenForCircuit(0x2540be400, 0xa63a140) D:/Desktop2/reddit-placebot-2023-master/util.go:82 +0x102 created by main.(*Client).Setup D:/Desktop2/reddit-placebot-2023-master/client.go:245 +0x363

Process finished with the exit code 2

Go check the latest, more logging

gigantino commented 1 year ago

now : 2023-07-23T10:28:52.986+0800 INFO reddit-placebot-2023-master/client.go:81 Login successful {"username": "Klutzy-Put-6652"} panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x728cf2] goroutine 100 [running]: main.listenForCircuit(0x2540be400, 0xa63a140) D:/Desktop2/reddit-placebot-2023-master/util.go:82 +0x102 created by main.(*Client).Setup D:/Desktop2/reddit-placebot-2023-master/client.go:245 +0x363 Process finished with the exit code 2

Go check the latest, more logging

Just cloned, I'm getting this now

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x796316]

goroutine 222 [running]:
main.ImageColorConvert(0xc000343728)
    /home/gigantino/place/reddit-placebot-2023/board.go:143 +0x76
main.(*Client).connect(0xc0002a4700, 0xc000073cc0)
    /home/gigantino/place/reddit-placebot-2023/client.go:191 +0x765
created by main.(*Client).Login
    /home/gigantino/place/reddit-placebot-2023/client.go:46 +0x54d
Edouard127 commented 1 year ago

There may be something wrong with your bmp image

cereal-kitty commented 1 year ago

reddit-placebot-2023-master/board.go:50
Controller changed {"username": "Klutzy-Put-6652"} Get "https://api.ipify.org?format=json": socks connect tcp 127.0.0.1:9050->api.ipify.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target machine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x9e8db4]

goroutine 42 [running]: main.listenForCircuit(0x2540be400, 0xa0b53e0) D:/Desktop2/reddit-placebot-2023-master/util.go:89 +0x1c4 created by main.(*Client).Setup D:/Desktop2/reddit-placebot-2023-master/client.go:245 +0x363

Process finished with the exit code 2

Edouard127 commented 1 year ago

@cereal-kitty I've tried moving the circuit listening somewhere else to avoid spamming the api, try again using the latest commit

cereal-kitty commented 1 year ago

Waiting for login to finish... Get "https://api.ipify.org?format=json": socks connect tcp 127.0.0.1:9050->api.ipify.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target mac hine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x4a8e24]
goroutine 40 [running]:
main.listenForCircuit(0x2540be400, 0xa2864a0)
D:/Desktop2/reddit-placebot-2023-master/util.go:89 +0x1c4 created by main.main D:/Desktop2/reddit-placebot-2023-master/main.go:61 +0x6cd Process finished with the exit code 2

Edouard127 commented 1 year ago

Waiting for login to finish... Get "https://api.ipify.org?format=json": socks connect tcp 127.0.0.1:9050->api.ipify.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target mac hine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x4a8e24] goroutine 40 [running]: main.listenForCircuit(0x2540be400, 0xa2864a0) D:/Desktop2/reddit-placebot-2023-master/util.go:89 +0x1c4 created by main.main D:/Desktop2/reddit-placebot-2023-master/main.go:61 +0x6cd Process finished with the exit code 2

Alright so I've changed the api, try again If It doesn't work I don't know what else to do

gigantino commented 1 year ago

Not opening a new issue as I think it could be related to this one:

2023-07-23T05:07:45.791+0200    INFO    reddit-placebot-2023/client.go:308  There was an error placing pixel    {"username": "No_Hurry6101", "message": "Pixel was not placed, or was placed somewhere else"}

What could be causing this issue?

Edouard127 commented 1 year ago

Not opening a new issue as I think it could be related to this one:

2023-07-23T05:07:45.791+0200  INFO    reddit-placebot-2023/client.go:308  There was an error placing pixel    {"username": "No_Hurry6101", "message": "Pixel was not placed, or was placed somewhere else"}

What could be causing this issue?

24

Edouard127 commented 1 year ago

https://github.com/Edouard127/reddit-placebot-2023/pull/40#issuecomment-1646733737

Marking this as complete, reopen if the error persist

kroW-Urven commented 1 year ago

Waiting for login to finish... Get "https://api.ipify.org?format=json": socks connect tcp 127.0.0.1:9050->api.ipify.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target mac hine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x4a8e24] goroutine 40 [running]: main.listenForCircuit(0x2540be400, 0xa2864a0) D:/Desktop2/reddit-placebot-2023-master/util.go:89 +0x1c4 created by main.main D:/Desktop2/reddit-placebot-2023-master/main.go:61 +0x6cd Process finished with the exit code 2

Alright so I've changed the api, try again If It doesn't work I don't know what else to do

Getting the same issue

Get "https://api.seeip.org/jsonip": socks connect tcp 127.0.0.1:9050->api.seeip.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target machine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0x8d8db7]

goroutine 180 [running]: main.listenForCircuit(0x2540be400, 0xa894100) C:/util.go:89 +0x1c7 created by main.(*Client).Setup C:/client.go:245 +0x363

thedankeststorm commented 1 year ago

Same problem for me

C:\Users\Administrator\Downloads\reddit-placebot-2023-master\reddit-placebot-2023-master>redditplacebot -minX=64 -minY=64 Waiting for login to finish... 2023-07-23T21:44:05.751+0700 INFO reddit-placebot-2023-master/client.go:47 Login successful {"username": "Warm-Place1784"} Login finished! Waiting for board data 2023-07-23T21:44:06.244+0700 INFO reddit-placebot-2023-master/board.go:50 Controller changed {"username": "Warm-Place1784"} Board data received! 2023-07-23T21:44:07.440+0700 INFO reddit-placebot-2023-master/worker.go:49 Placing client {"username": "Warm-Place1784"} Placing pixel {82 64} {255 214 53} 4 {582 64} Get "https://api.seeip.org/jsonip": socks connect tcp 127.0.0.1:9050->api.seeip.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target machine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x24 pc=0xf08db7] goroutine 35 [running]: main.listenForCircuit(0x2540be400, 0xa8c60e0) C:/Users/Administrator/Downloads/reddit-placebot-2023-master/reddit-placebot-2023-master/util.go:89 +0x1c7 created by main.(*Client).Setup C:/Users/Administrator/Downloads/reddit-placebot-2023-master/reddit-placebot-2023-master/client.go:245 +0x363

cereal-kitty commented 1 year ago

i tried to figure out and it seems that it is related to proxy or port9050 opened unsuccessfully. but actually i don't know how to solve.

Kali1661 commented 1 year ago

Getting the same error

Kali1661 commented 1 year ago

Fixed by running tor.exe from expert bundle

EmotionIce commented 1 year ago

Fixed by running tor.exe from expert bundle

Didnt fix it for me.

RoboPenguin7 commented 1 year ago

@Edouard127

Just cloned, same issue as before. Any suggestions?

Get "https://api.seeip.org/jsonip": socks connect tcp 127.0.0.1:9050->api.seeip.org:443: dial tcp 127.0.0.1:9050: connectex: No connection could be made because the target machine actively refused it. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x48 pc=0xe122b9]

Could this be a firewall problem, or is it an API problem?

RoboPenguin7 commented 1 year ago

Nevermind. Having tor.exe running in background fixed it

RoboPenguin7 commented 1 year ago

Error receiving message from socket read tcp 192.168.4.69:53120->34.204.41.68:443: wsarecv: An established connection was aborted by the software in your host machine.

New error between every login

kroW-Urven commented 1 year ago

Nevermind. Having tor.exe running in background fixed it

Error receiving message from socket read tcp 192.168.4.69:53120->34.204.41.68:443: wsarecv: An established connection was aborted by the software in your host machine.

New error between every login

Having tor.exe running in the background got: "Error receiving message from socket EOF" between logins. Then "login finished!" but I had "Waiting for board data" and nothing happened.

RoboPenguin7 commented 1 year ago

Nevermind. Having tor.exe running in background fixed it

Error receiving message from socket read tcp 192.168.4.69:53120->34.204.41.68:443: wsarecv: An established connection was aborted by the software in your host machine. New error between every login

Having tor.exe running in the background got: "Error receiving message from socket EOF" between logins. Then "login finished!" but I had "Waiting for board data" and nothing happened.

Map on r/place updated. Wait for @Edouard127 to update

cereal-kitty commented 1 year ago

For this problem, for the latest version only, check your localhost 9050. For windows, run tor.exe or tor.exe --service install netstat -aon in cmd to see if 9050 is open

EmotionIce commented 1 year ago

I managed to solve to issue using these steps

  1. Go into router settings and allow usage of port 9050 (TCP)
  2. run cmd as admin and run tor.exe --service install in the correct folder
  3. when this is finished, run tor.exe also as admin in cmd and leave the cmd tab open
  4. open another admin cmd tab and run the bot

Not sure if all those steps are necessary to solve this issue, but this did it for me.

Edouard127 commented 1 year ago

The issue should be fixed, reopen if it occurs again

dpgh552345 commented 1 year ago

D:\New folder\reddit-placebot-2023-master>redditplacebot -minX=64 -minY=64 Waiting for login to finish... 2023-07-25T16:06:38.131+0700 INFO reddit-placebot-2023/client.go:50 Login successful {"username": "Huypham3105"} Login finished! panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x10 pc=0x723ab6]

goroutine 1 [running]: main.(Board).GetDifferentData(0xc0000bc280) D:/a/reddit-placebot-2023/reddit-placebot-2023/board.go:43 +0xb6 main.(Worker).Run(0xc0000bc2c0) D:/a/reddit-placebot-2023/reddit-placebot-2023/worker.go:37 +0x58 main.main() D:/a/reddit-placebot-2023/reddit-placebot-2023/main.go:47 +0x5cf

cereal-kitty commented 1 year ago

It's a different problem related to the update of canvas again.... Maybe we should give our dear Edouard a rest, he had done a lot to help people build a bot. If u are trying to paint your own artwork, consider using auto scripts which works better at preventing reddit's adjustments.