Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    errno 12 ENOMEM ?

    Scheduled Pinned Locked Moved LoPy
    bluetoothenomembeaconslopyerrno 12
    21 Posts 7 Posters 8.4k Views 7 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      livius @alvaroav
      last edited by

      @alvaroav said in errno 12 ENOMEM ?:

      ENOMEM

      then i have not clue maybe @daniel @administrators can help more
      i do not see the reason of out of memory exception

      think about people first, then computers

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        alvaroav @livius
        last edited by

        @livius

        Thanks agian

        BTW I already ordered a Wipy3.0 module, in order to check that the RAM increase from 512KB to 4MB avoids this issue...

        I'll keep you updated.

        Thanks

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          alvaroav @alvaroav
          last edited by

          @alvaroav

          I received today the new Wipy 3.0, and the problem is still the same.

          Someone with some ideas?

          Thanks

          1 Reply Last reply Reply Quote 0
          • J Offline
            jcaron
            last edited by

            On what line does the error actually occur? Given the different behaviour when the socket is kept or closed I guess it should be on the socketUDP.sendto line, but just to be sure...

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              alvaroav @jcaron
              last edited by

              @jcaron

              Dear jcaron

              Exactly, is on the socketUDP.sendto line, but sometimes it happens some others not.

              I open and close the socket every iteration on the loop, as suggested by other users.

              B 1 Reply Last reply Reply Quote 0
              • sebS Offline
                seb
                last edited by

                One suggestion would be to set the socket as blocking, then send, then close the socket. This will ensure that all the data has been sent.

                1 Reply Last reply Reply Quote 0
                • B Offline
                  blindman2k @alvaroav
                  last edited by blindman2k

                  @alvaroav I saw the same behavior with the UDP client sockets. I was using UDP sockets to log to a server so I could debug issues remotely but it turned out the biggest issue was actually the UDP logger. I never solved it rather just removed the logger.

                  What's odd is I have another bidirectional UDP client that works just fine. Maybe the difference is I am reading its buffer with recvfrom() on every loop thus clearing its memory.

                  I also find the wlan.scan() function throws the same error when there are no networks visible. That exception is caught successfully by a try/except block. Something else you can try.

                  A 1 Reply Last reply Reply Quote 0
                  • A Offline
                    alvaroav @blindman2k
                    last edited by

                    @blindman2k @seb

                    Thank you very much for your help and support.

                    I've been working around this tipic on the last days, atill without a solution, but with some conclusions ready.

                    I work with a client continously sending data, and a "server" which is an sniffer, listeing to all UDP packets received (liek your UDP logger @blindman2k).
                    When th elogger is correctly working, and listeing, there is no error
                    When the sniffer is closed, or the wifi from the sniffer PC is unliked (sometime happens), the error appears.

                    It seems that the UDP sockets need the confirmation from reception in the server side... this is strange since I understood (maybe I am worng) that the UDP sockets do not rely on any reception acknowldege, and is a lossy protocol (instead of the TCP sockets where the transmission is controlled).

                    I will still working on the blocking UDP, I havce found some tutorials, but some of them are just for python and not micropython, with different commads not available on our wipy.

                    Moreover, my idea is to have an stand alone remote sensor sending UDP packets, and a receptor, just sniffering them when required... like the OSC protocol.

                    http://opensoundcontrol.org/spec-1_0

                    Thanks and BR

                    A 1 Reply Last reply Reply Quote 0
                    • A Offline
                      alvaroav @alvaroav
                      last edited by

                      @alvaroav

                      Dear all,

                      More advances on the ENOMEN.
                      I still have random success or unsuccess data transmisios with a UDP client (Wipy) / UDP server (PC host) programs.
                      However, I tried to use a TCP server on the PC host, and the surprise is that I am able to send data from teh wipy without any ENOMEN error!
                      Unfortunately the TCP server is not able to receive the data frames (as expected, since I am using UDP for Tx)

                      This is the code for the TCP server:

                      import socket
                      
                      # Listen on port 8000
                      # (to all IP addresses on this system)
                      #listen_addr = ("",8000)
                      listen_addr = ('192.168.1.158',8000)
                      
                      # Set up a TCP server
                      TCPSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                      
                      TCPSock.bind(listen_addr)
                      TCPSock.listen()
                      
                      print("Ready to listen\n")
                      
                      while True:
                      	TCPSock.accept()		# accept the connection
                      	data, addr = TCPSock.recvfrom(1024)	
                      	while data:			        # till data is coming
                      		print(data)
                      		data, addr = TCPSock.recvfrom(1024)
                      	print("All Data Received")	# Will execute when all data is received
                      	#TCPSock.close()
                      	break
                      

                      Any ideas with this new info?

                      When I tried to do the same with UDP, both socket.listen() and socket.accept() seems to be "not compatible" with the socet object.

                      I will still try to develop a success UDP server, based on this new advances.

                      Thanks to all!

                      A 1 Reply Last reply Reply Quote 0
                      • A Offline
                        alvaroav @alvaroav
                        last edited by

                        @alvaroav

                        Dear all,

                        Some advances by the end of the week.
                        I have tried from a clean code, just building a new program. I come back to the option to open the socket, send all data in a loop, and at the end of the loop, close the socket.
                        I am not so sure why, BUT now the ENOMEM error just appears from time to time. Moreover, I don't need any server (blocking or non-blocking) running.
                        Moreover, I place this exception into the loop, and allow me to "reconnect" and continue the program even if an error appers.

                        flag = 1
                        Nerrors = 0;
                        socketUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                        
                        while (flag<200):
                            time.sleep(0.05)
                            data=bytes()
                            data = data + b'counter = ' + bytes(str(flag),'utf-8')
                            try:
                                sent = socketUDP.sendto(data, addr)
                                print(data)
                                led.toggle()
                                flag=flag+1
                            except OSError:
                                Nerrors+=1
                                print('error ', Nerrors)
                                continue
                        socketUDP.close()
                        

                        I am thinking that the problem might come from the wifi connection to the router... I will check this next week.

                        BR

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom