Re: [libRETS-users] libRets 1.5.3 x86 and .Net 4xSystem.AccessViolationException

119 views
Skip to first unread message

Michael Granovski

unread,
Feb 17, 2014, 6:19:20 PM2/17/14
to library
I got an error on getMetadata. Can you help me? Metadata url is an empty string and readonly. Session login is success.

----- Reply message -----
From: "Brad Larsen" <br...@pageonewebsolutions.com>
To: "For discussion and help for and by the users of the libRETS C++ library" <libret...@crt.realtors.org>
Subject: [libRETS-users] libRets 1.5.3 x86 and .Net 4xSystem.AccessViolationException
Date: Mon, Feb 17, 2014 4:10 pm


I haven't, yet, but that could potentially work.  For pages where we're loading all images for 1 MLS Id to feed a slideshow, I'm doing this... (a generic list object of string)

        public List<string> AllPhotos(string mlsId, int size=0)
        {
            GetObjectResponse response;
            try{
            var sizeTxt = "Photo";
            switch (size)
            {
                case 500:
                    sizeTxt = "640x480";
                    break;
                case 1000:
                    sizeTxt = "HiRes";
                    break;
                default:
                    sizeTxt = "Photo";
                    break;
            }
            var photos = new GetObjectRequest("Property", sizeTxt);
            photos.AddAllObjects(mlsId);
            photos.SetLocation(true);
            photos.GetLocation();
            _rets.SetDefaultEncoding(EncodingType.RETS_XML_DEFAULT_ENCODING);
            response = _rets.GetObject(photos);
            var items = (from ObjectDescriptor objectDescriptor in response select objectDescriptor.GetLocationUrl()).ToList();
            return items;
            }
            catch (Exception ex)
            {
                
            }
            return new List<string>();
        }

I do something similar for pages where we're listing multiple MLS listings, and I think that's where it's blowing up (because this was rushed).  

Is there a way that I can pass a collection of MLS Ids as search criteria to get the first image for each in one call?  I can't really build a search based on criteria, because this site lists from multiple MLS providers, including their own listings mixed in.  


On Mon, Feb 17, 2014 at 2:54 PM, David Bills <DBi...@ppar.org> wrote:

Have you tried one RETS session to search for photos, dispose, and a new RETS session to pull images?

 

I use an in-memory data table from the search as source for the get object requests.

 

Dave Bills

Senior Applications Programmer \ Technical Support

Pikes Peak Association of REALTORS®

 

719-476-8154 Direct

 

 

 

From: librets-us...@crt.realtors.org [mailto:librets-us...@crt.realtors.org] On Behalf Of Brad Larsen
Sent: Monday, February 17, 2014 11:40 AM
To: libret...@crt.realtors.org
Subject: [libRETS-users] libRets 1.5.3 x86 and .Net 4xSystem.AccessViolationException

 

We're using this library to retrieve MLS images from FlexMLS, and we've been getting regular exceptions in windows, and it appears to be taking down our website every few hours.  I saw a few threads related to this, but the only solution I've come across is rolling .net back to 3.5.  Does anyone have any leads or a solution to this problem?

 

Thanks in advance.

 

source seems to be at:  librets.libretsPINVOKE.RetsSession_GetObject

 

Exception 1:  

 

Application: w3wp.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.AccessViolationException

Stack:

   at librets.libretsPINVOKE.RetsSession_GetObject(HandleRef jarg1, HandleRef jarg2)

   at librets.RetsSession.GetObject(GetObjectRequest request)

   at PremierFeed.FlexMls.MlsImages.AllPhotos(String mlsId, Int32 size)

   at PremierFeed.Data.Domain.ImageService.GetPhotos(String mls, Int32 size)

 

 

and

Exception 2:

 

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 librets-dotnet, P5 0.0.0.0, P6 4f5d25f9, P7 362, P8 1, P9 system.accessviolationexception, P10 NIL.

 

 

 

and

Exception 3:

 

An unhandled exception occurred and the process was terminated.

Application ID: DefaultDomain

Process ID: 4900

Exception: System.AccessViolationException

Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

StackTrace:    at librets.libretsPINVOKE.RetsSession_GetObject(HandleRef jarg1, HandleRef jarg2)

 

 

--

Page One Web Solutions

Bradley Larsen / .Net Developer
x716 / br...@pageonewebsolutions.com

Page One Web Solutions Office: 1-888-274-0483 / Fax: 1-866-473-9751 
250 Commercial St., Portland, ME 04101 
http://www.pageonewebsolutions.com

Facebook Twitter Google Plus Linkedin Instagram

This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-m


_______________________________________________
libRETS-users mailing list
libRET...@crt.realtors.org
http://mail.crt.realtors.org/mailman/listinfo/librets-users




--

Page One Web Solutions

Bradley Larsen / .Net Developer
x716 / br...@pageonewebsolutions.com

Page One Web Solutions Office: 1-888-274-0483 / Fax: 1-866-473-9751 
250 Commercial St., Portland, ME 04101 
http://www.pageonewebsolutions.com

Facebook Twitter Google Plus Linkedin Instagram

This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-m

Michael Granovski

unread,
Feb 18, 2014, 5:51:07 PM2/18/14
to library
Did you try to extend a session timeout?

----- Reply message -----
From: "Brad Larsen" <br...@pageonewebsolutions.com>
To: "For discussion and help for and by the users of the libRETS C++ library" <libret...@crt.realtors.org>
Subject: [libRETS-users] libRets 1.5.3 x86 and .Net 4xSystem.AccessViolationException
Date: Tue, Feb 18, 2014 2:07 pm


This is what I ended up doing, and so far (still testing), it appears to be working via "AddObject".  The gist is... passing a list of MLS Ids, AddObject for each Id ... GetLocationURL for each item in the response ToList().  

 public List<string> ThumbNails(List<string> ids)
        {
            var photos = new GetObjectRequest("Property", "Photo");
            foreach (var mls in ids)
            {
                photos.AddObject(mls,0);
            }
            photos.SetLocation(true);
            photos.GetLocation();
            _rets.SetDefaultEncoding(EncodingType.RETS_XML_DEFAULT_ENCODING);
            var response = _rets.GetObject(photos);
            var items = (from ObjectDescriptor objectDescriptor in response select objectDescriptor.GetLocationUrl()).ToList();
            return items;
        }

I'm getting about 15 or 20 at a time... I'll report back if this has any issues.


On Tue, Feb 18, 2014 at 1:01 PM, Jonathan Otsuka <djg...@gmail.com> wrote:
Interesting. So in theory it could be faster to pass in multiple listings with wildcard all object IDs then to querying with addallobjects for each individual listing?

Jonathan Otsuka

> On Feb 18, 2014, at 11:44 AM, Mark Klein <lib...@dis.com> wrote:
>
>
>> On Feb 18, 2014, at 9:18 AM, Jonathan Otsuka <djg...@gmail.com> wrote:
>>
>> I haven't seen a way to add multiple objects to a request. I just process with one request at a time using addobject or addallobjects.
>
> You can use AddObject to get media from multiple listings in one request. But, keep in mind, media can get large and you don't want the request to get too big.
>
>
>> From the c++ example ("resourceSet" can be <key>:<image id> as in "LN0001:1, LN0002:1, LN0003:*", etc).
>
>        GetObjectRequest getObjectRequest(resource, type);
>
>        vector<string>::const_iterator i;
>        for (i = resourceSets.begin(); i != resourceSets.end(); i++)
>        {
>            vector<string> resourceSet;
>            ba::split(resourceSet, *i, ba::is_any_of(":"));
>            if (resourceSet.size() == 1)
>            {
>                getObjectRequest.AddAllObjects(resourceSet[0]);
>            }
>            else if (resourceSet.size() == 2)
>            {
>                vector<string> ids;
>                ba::split(ids, resourceSet[1], ba::is_any_of(","));
>                vector<string>::const_iterator idString;
>                for (idString = ids.begin(); idString != ids.end();
>                     idString++)
>                {
>                    int id  = lexical_cast<int>(*idString);
>                    getObjectRequest.AddObject(resourceSet[0], id);
>                }
>            }
>        }
>        getObjectRequest.SetLocation(returnUrl);
>        getObjectRequest.SetIgnoreMalformedHeaders(ignoreMalformedHeaders);
>
>        GetObjectResponseAPtr getObjectResponse =
>            session->GetObject(&getObjectRequest);
>
>
>>
>> Jonathan Otsuka
>>
>>> On Feb 18, 2014, at 8:38 AM, Brad Larsen <br...@pageonewebsolutions.com> wrote:
>>>
>>> Can you add multiple objects to the same request, or is this doing things multiple times before closing the session?
>>>
>>>
>>> On Mon, Feb 17, 2014 at 8:05 PM, Jonathan Otsuka <djg...@gmail.com> wrote:
>>> I don't think there is a function to pull only the first image for a list of listings. You can build a function to do it with addobject though.
>>>
>>> http://www.crt.realtors.org/projects/rets/librets/documentation/api/classlibrets_1_1_get_object_request.html#93671703cad19109acebf0b33cb32530
>>>
>>> Jonathan Otsuka
>>>> Bradley Larsen / .Net Developer
>>>> x716 / br...@pageonewebsolutions.com
>>>>
>>>> Page One Web Solutions Office: 1-888-274-0483 / Fax: 1-866-473-9751
>>>> 250 Commercial St., Portland, ME 04101
>>>> http://www.pageonewebsolutions.com
>>>>
>>>>
>>>>
>>>> This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-m
>>>>
>>>>
>>>> _______________________________________________
>>>> libRETS-users mailing list
>>>> libRET...@crt.realtors.org
>>>> http://mail.crt.realtors.org/mailman/listinfo/librets-users
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Bradley Larsen / .Net Developer
>>>> x716 / br...@pageonewebsolutions.com
>>>>
>>>> Page One Web Solutions Office: 1-888-274-0483 / Fax: 1-866-473-9751
>>>> 250 Commercial St., Portland, ME 04101
>>>> http://www.pageonewebsolutions.com
>>>>
>>>>
>>>>
>>>> This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-m
>>>>
>>>> _______________________________________________
>>>> libRETS-users mailing list
>>>> libRET...@crt.realtors.org
>>>> http://mail.crt.realtors.org/mailman/listinfo/librets-users
>>>
>>> _______________________________________________
>>> libRETS-users mailing list
>>> libRET...@crt.realtors.org
>>> http://mail.crt.realtors.org/mailman/listinfo/librets-users
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Bradley Larsen / .Net Developer
>>> x716 / br...@pageonewebsolutions.com
>>>
>>> Page One Web Solutions Office: 1-888-274-0483 / Fax: 1-866-473-9751
>>> 250 Commercial St., Portland, ME 04101
>>> http://www.pageonewebsolutions.com
>>>
>>>
>>>
>>> This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited.. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Company Name is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-m
Reply all
Reply to author
Forward
0 new messages